Yuriy Taraday | 84a2103 | 2017-06-27 11:13:16 +0400 | [diff] [blame^] | 1 | import logging |
| 2 | |
| 3 | def 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 | } |