PyLint fixes.

This commit is contained in:
C. R. Oldham 2014-01-16 14:33:20 -07:00
parent 4377c9b2d3
commit f82674b60b
6 changed files with 11 additions and 47 deletions

View File

@ -16,6 +16,7 @@ def __virtual__():
else:
return __virtualname__
def location():
return {'location': 'dc-1-europe'}
@ -26,6 +27,6 @@ def os_family():
def os_data():
facts = __opts__['proxyconn'].facts
facts['version_info'] = { 'major': '12,1', 'type': 'I', 'minor': '20131108_srx_12q1_x46_intgr', 'build': '0-613414' }
facts['version_info'] = {'major': '12,1', 'type': 'I', 'minor': '20131108_srx_12q1_x46_intgr', 'build': '0-613414'}
facts['os_family'] = 'proxy'
return facts

View File

@ -545,7 +545,7 @@ class Minion(object):
log.debug('I am {0} and I need to start some proxies for {0}'.format(self.opts['id'],
self.opts['pillar']['proxy']))
for p in self.opts['pillar']['proxy']:
log.debug('Starting {} proxy.'.format(p))
log.debug('Starting {0} proxy.'.format(p))
pid = os.fork()
if pid > 0:
continue
@ -554,7 +554,7 @@ class Minion(object):
proxyminion.start(self.opts['pillar']['proxy'][p])
self.clean_die(signal.SIGTERM, None)
else:
log.debug("I am {} and I am not supposed to start any proxies.".format(self.opts['id']))
log.debug("I am {0} and I am not supposed to start any proxies.".format(self.opts['id']))
def _prep_mod_opts(self):
'''

View File

@ -72,8 +72,8 @@ def set_hostname(hostname=None, commit=True):
if commit:
return commit()
else:
single['out'] = True
single['message'] = 'set system host-name {} is queued'.format(hostname)
ret['out'] = True
ret['msg'] = 'set system host-name {0} is queued'.format(hostname)
return ret
@ -82,15 +82,16 @@ def commit():
conn = __opts__['proxyconn']
ret = {}
commit_ok = conn.cu.commit_check()
if commit_ok:
try:
conn.cu.commit(confirm=True)
ret['out'] = True
ret['message'] = 'Commit Successful.'
except EzNcException as e:
except Exception as e:
ret['out'] = False
ret['message'] = 'Pre-commit check succeeded but actual commit failed with "{}"'.format(e.message)
ret['message'] = 'Pre-commit check succeeded but actual commit failed with "{0}"'.format(e.message)
else:
ret['out'] = False
ret['message'] = 'Pre-commit check failed.'

View File

@ -16,6 +16,7 @@ import salt.loader
__proxyenabled__ = ['*']
def echo(text):
'''
Return a string - used for testing the connection

View File

@ -1,36 +0,0 @@
# -*- coding: utf-8 -*-
'''
Dumb test pillar module
'''
# Import python libs
import logging
import re
def __virtual__():
return 'test_pillar'
# Set up logging
log = logging.getLogger(__name__)
def ext_pillar(minion_id,
pillar,
collection='pillar',
id_field='_id',
re_pattern=None,
re_replace='',
fields=None):
my_pillar = { 'junos_hosts':
{
'junos' : {
'user' : 'cro',
'passwd': 'croldham123'
},
'junos1' : {
'user' : 'cro',
'passwd' : 'croldham123'
}
}
}
return my_pillar

View File

@ -15,24 +15,21 @@ HAS_JUNOS = True
class Proxyconn(object):
def __init__(self, details):
self.conn = jnpr.junos.Device(user=details['username'], host=details['host'], password=details['passwd'])
self.conn.open()
self.conn.bind(cu=jnpr.junos.cfg.Resource)
def proxytype(self):
return 'junos'
def id(self, opts):
return self.conn.facts['hostname']
def ping(self):
return self.conn.connected
def shutdown(self, opts):
print('Proxy module {0} shutting down!!'.format(opts['id']))