blob: d5272c0a5d884ef4b8551b634cf53c7d0429f238 [file] [log] [blame]
Yuriy Taraday84a21032017-06-27 11:13:16 +04001import logging
2
3def present(name, chart_name, version=None, values=None, logLevel=None):
4 exists = __salt__['helm.release_exists'](name)
5 if not exists:
6 result = __salt__['helm.release_create'](
7 name, chart_name, version, values)
8 if result:
9 return {
10 'name': name,
11 'changes': {name: 'CREATED'},
12 'result': True,
13 'comment': 'Release "{}" was created'.format(name),
14 }
15 else:
16 return {
17 'name': name,
18 'changes': {},
19 'result': False,
20 'comment': 'Failed to create release "{}"'.format(name),
21 }
22 return {
23 'name': name,
24 'changes': {},
25 'result': True,
26 'comment': 'Release "{}" already exists'.format(name),
27 }