55def managed (name , present = {}, absent = [], exclusive = False , helm_home = None ):
66 '''
77 Ensure the supplied repositories are available to the helm client. If the
8- `exclusive` flag is set to a truthy value, any extra repositories in the
8+ `exclusive` flag is set to a truthy value, any extra repositories in the
99 helm client will be removed.
1010
1111 name
1212 The name of the state
1313
1414 present
15- A dict of repository names to urls to ensure are registered with the
15+ A dict of repository names to urls to ensure are registered with the
1616 Helm client
17-
17+
1818 absent
1919 A list of repository names to ensure are unregistered from the Helm client
20-
20+
2121 exclusive
22- A boolean flag indicating whether the state should ensure only the
22+ A boolean flag indicating whether the state should ensure only the
2323 supplied repositories are availabe to the target minion.
2424
2525 helm_home
26- An optional path to the Helm home directory
26+ An optional path to the Helm home directory
2727 '''
2828 ret = {'name' : name ,
2929 'changes' : {},
3030 'result' : True ,
3131 'comment' : '' }
32-
32+
3333 try :
3434 result = __salt__ ['helm.manage_repos' ](
35- present = present ,
36- absent = absent ,
35+ present = present ,
36+ absent = absent ,
3737 exclusive = exclusive ,
3838 helm_home = helm_home
3939 )
@@ -50,7 +50,7 @@ def managed(name, present={}, absent=[], exclusive=False, helm_home=None):
5050 return ret
5151
5252 ret ['comment' ] = ("Repositories were in the desired state: "
53- "%s" % [name for (name , url ) in present .iteritems ()])
53+ "%s" % [name for (name , url ) in present .items ()])
5454 return ret
5555 except CommandExecutionError as e :
5656 ret ['result' ] = False
@@ -59,24 +59,24 @@ def managed(name, present={}, absent=[], exclusive=False, helm_home=None):
5959
6060def updated (name , helm_home = None ):
6161 '''
62- Ensure the local Helm repository cache is up to date with each of the
63- helm client's configured remote chart repositories. Because the `helm repo
64- update` command doesn't indicate whether any changes were made to the local
62+ Ensure the local Helm repository cache is up to date with each of the
63+ helm client's configured remote chart repositories. Because the `helm repo
64+ update` command doesn't indicate whether any changes were made to the local
6565 cache, this will only indicate change if the Helm client failed to retrieve
66- an update from one or more of the repositories, regardless of whether an
66+ an update from one or more of the repositories, regardless of whether an
6767 update was made to the local Helm chart repository cache.
6868
6969 name
7070 The name of the state
7171
7272 helm_home
73- An optional path to the Helm home directory
73+ An optional path to the Helm home directory
7474 '''
7575 ret = {'name' : name ,
7676 'changes' : {},
7777 'result' : True ,
7878 'comment' : 'Successfully synced repositories: ' }
79-
79+
8080
8181 try :
8282 result = __salt__ ['helm.update_repos' ](helm_home = helm_home )
@@ -86,20 +86,20 @@ def updated(name, helm_home=None):
8686 r'Successfully got an update from the \"([^\"]+)\"' , result ['stdout' ])
8787 failed_repos = re .findall (
8888 r'Unable to get an update from the \"([^\"]+)\"' , result ['stdout' ])
89-
89+
9090 if failed_repos and len (failed_repos ) > 0 :
9191 ret ['result' ] = False
9292 ret ['changes' ]['succeeded' ] = success_repos
9393 ret ['changes' ]['failed' ] = failed_repos
9494 ret ['comment' ] = 'Failed to sync against some repositories' + cmd_str
9595 else :
9696 ret ['comment' ] += "%s" % success_repos + cmd_str
97-
97+
9898 except CommandExecutionError as e :
9999 ret ['name' ] = e .cmd
100100 ret ['result' ] = False
101- ret ['comment' ] = ("Failed to update repos: %s" % e .error +
101+ ret ['comment' ] = ("Failed to update repos: %s" % e .error +
102102 "\n Executed command: %s" % e .cmd )
103103 return ret
104104
105- return ret
105+ return ret
0 commit comments