mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #5178 from virtua-network/imgadm_feature
smartos_imgadm : add a *basic* search option and an update function
This commit is contained in:
commit
dddb91a12e
1 changed files with 23 additions and 3 deletions
|
@ -55,13 +55,28 @@ def version():
|
|||
return ret[-1]
|
||||
|
||||
|
||||
def avail():
|
||||
def update_installed():
|
||||
'''
|
||||
Gather info on unknown images (locally installed)
|
||||
|
||||
CLI Example::
|
||||
|
||||
salt '*' imgadm.update_installed()
|
||||
'''
|
||||
imgadm = _check_imgadm()
|
||||
if imgadm:
|
||||
cmd = '{0} update'.format(imgadm)
|
||||
__salt__['cmd.run'](cmd)
|
||||
return {}
|
||||
|
||||
|
||||
def avail(search=None):
|
||||
'''
|
||||
Return a list of available images
|
||||
|
||||
CLI Example::
|
||||
|
||||
salt '*' imgadm.avail
|
||||
salt '*' imgadm.avail [percona]
|
||||
'''
|
||||
ret = {}
|
||||
imgadm = _check_imgadm()
|
||||
|
@ -71,7 +86,12 @@ def avail():
|
|||
if retcode != 0:
|
||||
ret['Error'] = _exit_status(retcode)
|
||||
return ret
|
||||
ret = res['stdout'].splitlines()
|
||||
if search:
|
||||
for line in res['stdout'].splitlines():
|
||||
if search in line:
|
||||
ret = line
|
||||
else:
|
||||
ret = res['stdout'].splitlines()
|
||||
return ret
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue