Skip to content

Instantly share code, notes, and snippets.

View davisj's full-sized avatar

Jake Davis davisj

View GitHub Profile
@davisj
davisj / doorapp.py
Created August 26, 2017 20:42
AppDaemon example
...
class DoorOpen(appapi.AppDaemon):
def initialize(self):
self.sound = self.get_app("Sound")
self.listen_state(self.door_opened, 'sensor.front_door', new="on")
def door_opened(self, entity, attribute, old, new, kwargs):
self.sound.tts('front door opened', 0.5, 4)
...
@davisj
davisj / Rendered Actual Result
Last active July 27, 2017 17:30
Overriding a pillar value from an include
bob:
groups:
- foo
- bar
- baz
shell: /bin/false
@davisj
davisj / 1 top.sls
Last active April 3, 2017 19:28
pillar merge
base:
'host1':
- users.host1
...
def ext_pillar(minion_id, pillar, *args, **kwargs):
er = ('XXX',)
erid = 'YYY'
log.debug(pprint({'erid': erid, 'er': er}))
return {'erid': erid, 'er': er}
[DEBUG ] Results of YAML rendering:
OrderedDict([('repos', OrderedDict([('xen', OrderedDict([('scheme', 'mirrorlist'), ('url', 'https://mirrors.fedoraproject.org/metalink?repo=xen4&arch=$basearch')]))]))])
[DEBUG ] compile template: /srv/pillar/repos/hyrax19.sls
[DEBUG ] Jinja search path: ['/srv/pillar']
[DEBUG ] Rendered data from file: /srv/pillar/repos/hyrax19.sls:
...
[DEBUG ] LazyLoaded roots.envs
[DEBUG ] Could not LazyLoad roots.init
[DEBUG ] Updating roots fileserver cache
[root@minion1 ~]# salt-call --local --file-root=/var/cache/salt/minion/files/base state.show_sls cron
...sls_output...
[root@minion1 ~]# salt-call --local --file-root=/var/cache/salt/minion/files/base --pillar-root=/var/cache/salt/minion/pillar state.show_sls cron
[INFO ] Loading fresh modules for state activity
local:
- No matching sls found for 'cron' in env 'base'
Traceback Switch to copy-and-paste view
/usr/lib/python2.6/site-packages/django/core/handlers/base.py in get_response
response = callback(request, *callback_args, **callback_kwargs)
...
▶ Local vars
/usr/lib/python2.6/site-packages/Bcfg2/Reporting/views.py in client_detail
@davisj
davisj / gist:5715774
Created June 5, 2013 17:46
'FailureEntry' object has no attribute 'state'
Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.6/site-packages/Bcfg2/Reporting/views.py" in client_detail
342. edict[etypes[ent.state]].append(ent)
Exception Type: AttributeError at /client/xxxxx
Exception Value: 'FailureEntry' object has no attribute 'state'
@davisj
davisj / gist:5699022
Created June 3, 2013 15:33
can't adapt type 'ProbeData'
Got cN server.domain.org; using as client name
Authenticating client server.domain.org
Client server.domain.org matches address 10.0.2.2
server.domain.org is running Bcfg2 client version 1.3.1
Got cN server.domain.org; using as client name
Authenticating client server.domain.org
Client server.domain.org matches address 10.0.2.2
Building metadata for server.domain.org
Metadata: Group centos6 suppressed by category os; server.domain.org already a member of centos5
Getting probes for server.domain.org
/builddir/build/BUILD/bcfg2-1.3.1/doc/client/tools/actions.txt:: ERROR: No XML complexType or simpleType ActionType found
/builddir/build/BUILD/bcfg2-1.3.1/doc/development/core.txt:67: WARNING: autodoc can't import/find module 'Bcfg2.Server.BuiltinCore', it reported error: "No module named daemo
n", please check your spelling and sys.path
/builddir/build/BUILD/bcfg2-1.3.1/doc/development/core.txt:77: WARNING: autodoc can't import/find module 'Bcfg2.Server.MultiprocessingCore', it reported error: "No module nam
ed daemon", please check your spelling and sys.path
/builddir/build/BUILD/bcfg2-1.3.1/doc/development/core.txt:82: WARNING: autodoc can't import/find module 'Bcfg2.Server.CherryPyCore', it reported error: "No module named cher
rypy", please check your spelling and sys.path
/builddir/build/BUILD/bcfg2-1.3.1/doc/development/fam.txt:62: WARNING: autodoc can't import/find module 'Bcfg2.Server.FileMonitor.Fam', it reported error: "No module named _f
am", please check your spelling and sys.path
/builddir/buil