Yum package state defaults to installed
This commit is contained in:
parent
8152e44efd
commit
ff5d329374
1 changed files with 2 additions and 6 deletions
|
@ -317,22 +317,18 @@ def main():
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
return 1, str(e)
|
return 1, str(e)
|
||||||
|
|
||||||
elif 'state' in params:
|
else:
|
||||||
pkg = params.get('pkg', params.get('package', params.get('name', None)))
|
pkg = params.get('pkg', params.get('package', params.get('name', None)))
|
||||||
if 'pkg' is None:
|
if 'pkg' is None:
|
||||||
results['msg'] = "No pkg specified"
|
results['msg'] = "No pkg specified"
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
my = yum_base(conf_file=params['conf_file'], cachedir=True)
|
my = yum_base(conf_file=params['conf_file'], cachedir=True)
|
||||||
state = params['state']
|
state = params.get('state', 'installed')
|
||||||
results = ensure(my, state, pkg)
|
results = ensure(my, state, pkg)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
return 1, str(e)
|
return 1, str(e)
|
||||||
|
|
||||||
else:
|
|
||||||
print json.dumps(dict(failed=True, msg='invalid module parameters'))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
print json.dumps(results)
|
print json.dumps(results)
|
||||||
return 0, None
|
return 0, None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue