Fix lint.

This commit is contained in:
C. R. Oldham 2015-08-06 16:31:57 -06:00
parent b5e643b9cd
commit 8261158b5a
6 changed files with 22 additions and 13 deletions

View file

@ -6,19 +6,21 @@ Thus, some grains make sense to get them from the minion (PYTHONPATH), but other
don't (ip_interfaces)
'''
import logging
import json
__proxyenabled__ = ['junos']
__virtualname__ = 'junos'
log = logging.getLogger(__name__)
def __virtual__():
if 'proxy' not in __opts__:
return False
else:
return __virtualname__
def _remove_complex_types(dictionary):
'''
Linode-python is now returning some complex types that
@ -27,19 +29,21 @@ def _remove_complex_types(dictionary):
for k, v in dictionary.iteritems():
if isinstance(v, dict):
dictionary[k] = remove_complex_types(v)
dictionary[k] = _remove_complex_types(v)
elif hasattr(v, 'to_eng_string'):
dictionary[k] = v.to_eng_string()
def defaults():
return {'os': 'proxy', 'kernel':'unknown', 'osrelease':'proxy'}
return {'os': 'proxy', 'kernel': 'unknown', 'osrelease': 'proxy'}
def facts():
log.debug('----------- Trying to get facts')
facts = __opts__['proxymodule']['junos.facts']()
facts['version_info'] = 'override'
return facts
log.debug('----------- Facts call to junos returned')
def os_family():
return {'os_family': 'junos'}

View file

@ -13,11 +13,12 @@ def __virtual__():
else:
return __virtualname__
def kernel():
return {'kernel':'proxy'}
return {'kernel': 'proxy'}
def os():
return {'os':'proxy'}
return {'os': 'proxy'}
def location():
return {'location': 'In this darn virtual machine. Let me out!'}

View file

@ -336,7 +336,7 @@ class SMinion(object):
pillarenv=self.opts.get('pillarenv'),
).compile_pillar()
self.utils = salt.loader.utils(self.opts)
self.functions = salt.loader.minion_mods(self.opts, utils=self.utils,
self.functions = salt.loader.minion_mods(self.opts,
include_errors=True)
self.proxy = salt.loader.proxy(self.opts, None)
# TODO: remove

View file

@ -55,9 +55,11 @@ def facts_refresh():
return __opts__['proxymodule']['junos.refresh']()
def call_rpc():
return __opts__['proxymodule']['junos.rpc']()
def set_hostname(hostname=None, commit_change=True):
conn = __opts__['proxymodule']['junos.conn']()
@ -130,4 +132,3 @@ def ping():
ret = dict()
ret['message'] = conn.probe()
ret['out'] = True

View file

@ -55,12 +55,14 @@ def id(opts):
'''
return thisproxy['conn'].facts['hostname']
def ping():
'''
Ping? Pong!
'''
thisproxy['conn'].connected
def shutdown(opts):
'''
This is called when the proxy-minion is exiting to make sure the

View file

@ -33,12 +33,14 @@ def __virtual__():
log.debug('rest_sample proxy __virtual__() called...')
return True
# Every proxy module needs an 'init', though you can
# just put a 'pass' here if it doesn't need to do anything.
def init(opts):
'''
Every proxy module needs an 'init', though you can
just put a 'pass' here if it doesn't need to do anything.
'''
log.debug('rest_sample proxy init() called...')
# Save the REST URL
# Save the REST URL
DETAILS['url'] = opts['proxy']['url']
# Make sure the REST URL ends with a '/'
@ -49,7 +51,7 @@ def init(opts):
def id(opts):
'''
Return a unique ID for this proxy minion. This ID MUST NOT CHANGE.
If it changes while the proxy is running the salt-master will get
If it changes while the proxy is running the salt-master will get
really confused and may stop talking to this minion
'''
r = salt.utils.http.query(opts['proxy']['url']+'id', decode_type='json', decode=True)
@ -168,4 +170,3 @@ def shutdown(opts):
For this proxy shutdown is a no-op
'''
log.debug('rest_sample proxy shutdown() called...')
pass