Skip to content

Commit

Permalink
Merge pull request saltstack#10345 from s0undt3ch/hotfix/lint
Browse files Browse the repository at this point in the history
Lint fixes
  • Loading branch information
thatch45 committed Feb 11, 2014
2 parents 4b69928 + 9784f64 commit 828d473
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
4 changes: 2 additions & 2 deletions salt/fileserver/gitfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def _stale_refs_pygit2(repo):
key = ' * [would prune] '
ret = []
for line in subprocess.Popen(
'git remote prune --dry-run origin'.format(remote),
'git remote prune --dry-run origin',
shell=True,
close_fds=True,
cwd=repo.workdir,
Expand Down Expand Up @@ -657,7 +657,7 @@ def update():
# Prune stale refs
for ref in repo.get_refs():
if ref not in refs_post:
del(repo[ref])
del repo[ref]
except Exception as exc:
log.warning(
'Exception caught while fetching: {0}'.format(exc)
Expand Down
18 changes: 15 additions & 3 deletions salt/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,16 @@ class Key(object):
'''
The object that encapsulates saltkey actions
'''

def __init__(self, opts):
self.opts = opts
self._prepare()

def _prepare(self):
'''
Simple method called when this class is initialized used for additional
setup
'''
self.event = salt.utils.event.MasterEvent(opts['sock_dir'])

def _check_minions_directories(self):
Expand Down Expand Up @@ -678,8 +686,12 @@ class RaetKey(Key):
'''
Manage keys from the raet backend
'''
def __init__(self, opts):
self.opts = opts

def _prepare(self):
'''
Simple method called when this class is initialized used for additional
setup
'''
self.serial = salt.payload.Serial(self.opts)

def _check_minions_directories(self):
Expand Down Expand Up @@ -766,7 +778,7 @@ def status(self, minion_id, device_id, pub, verify):
def _get_key_str(self, minion_id, status):
'''
Return the key string in the form of:
pub: <pub>
verify: <verify>
'''
Expand Down
24 changes: 12 additions & 12 deletions salt/modules/lxc.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,25 +288,25 @@ def list_():
frozen = []
running = []

for c in ctnrs:
lines = __salt__['cmd.run']('lxc-info -n ' + c).splitlines()
for container in ctnrs:
c_infos = __salt__['cmd.run']('lxc-info -n {0}'.format(container))

for line in lines:
stat = line.split(':')
for info in c_infos:
stat = info.split(':')
if stat[0] == 'state':
s = stat[1].strip()
state = stat[1].strip()
break

if not len(s):
if not len(state):
continue
if s == 'STOPPED':
stopped.append(c)
if state == 'STOPPED':
stopped.append(container)
continue
if s == 'FROZEN':
frozen.append(c)
if state == 'FROZEN':
frozen.append(container)
continue
if s == 'RUNNING':
running.append(c)
if state == 'RUNNING':
running.append(container)
continue

return {'running': running,
Expand Down

0 comments on commit 828d473

Please sign in to comment.