Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #126 from yzach/master
Browse files Browse the repository at this point in the history
Fixes issue #124
  • Loading branch information
jfindlay committed Jun 14, 2015
2 parents 8a2489f + 6fc1b29 commit e6b36b4
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions modules/iis.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ def _resource_list(resource):
'''

ret = []
cmd_ret = __salt__['cmd.run_all']('"{0}" list {1}'.format(
appcmd, resource
))
cmd_ret = __salt__['cmd.run_all']([appcmd, 'list', resource])
if cmd_ret['retcode'] != 0:
return False

Expand All @@ -71,9 +69,7 @@ def _resource_add(resource, name, settings=None, arg_name_override=None):
if arg_name_override is None:
arg_name_override = resource.lower()

cmd_ret = __salt__['cmd.run_all']('"{0}" add {1} /{2}.name:"{3}" {4}'.format(
appcmd, resource.upper(), arg_name_override, name, settings_params
))
cmd_ret = __salt__['cmd.run_all']([appcmd, 'add', resource.upper(), '/{0}.name:{1}'.format(arg_name_override, name)] + settings_params)
if cmd_ret['retcode'] != 0:
log.error('failed creating {0}'.format(resource))
log.debug(cmd_ret['stderr'])
Expand All @@ -88,9 +84,7 @@ def _resource_get_config(resource, name, settings):

ret = {}
for i in settings:
cmd_ret = __salt__['cmd.run_all']('"{0}" list {1} /{2}.name:"{3}" /text:{4}'.format(
appcmd, resource.upper(), resource.lower(), name, i
))
cmd_ret = __salt__['cmd.run_all']([appcmd, 'list', resource.upper(), '/{0}.name:{1}'.format(resource.lower(), name), '/text:{0}'.format(i)])
if cmd_ret['retcode'] != 0:
log.error('can\'t get "{0}" from {1} "{2}"'.format(i, resource, name))
return False
Expand All @@ -104,9 +98,7 @@ def _resource_set(resource, name, settings):
'''

settings_params = _serialize_settings(settings)
cmd_ret = __salt__['cmd.run_all']('"{0}" set {1} "{2}" {3}'.format(
appcmd, resource.upper(), name, settings_params
))
cmd_ret = __salt__['cmd.run_all']([appcmd, 'set', resource.upper(), name] + settings_params)
if cmd_ret['retcode'] != 0:
log.error('failed configuring {0}'.format(resource))
log.debug(cmd_ret['stderr'])
Expand All @@ -120,11 +112,11 @@ def _serialize_settings(settings):
'''

if not settings:
return ''
return ' '.join(map(
lambda (k, v): '/{0}:"{1}"'.format(k, v),
return []
return map(
lambda (k, v): '/{0}:{1}'.format(k, v),
settings.iteritems()
))
)


##############################
Expand Down

0 comments on commit e6b36b4

Please sign in to comment.