Filip Pytloun | 923d869 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | ''' |
| 3 | Management of Heat stacks |
| 4 | ============================== |
| 5 | |
| 6 | :depends: - python-heatclient>=0.2.3 Python module |
| 7 | :configuration: See :py:mod:`salt.modules.heat` for setup instructions. |
| 8 | |
| 9 | .. code-block:: yaml |
| 10 | |
| 11 | heat.keystone_endpoint: 'http://icehouse.cloudlab.cz:5000/v2.0' |
| 12 | heat.url: 'http://10.0.106.19:8004/v1/fc015a00cda344e9b66e3d99e0a0591a' |
| 13 | heat.username: 'admin' |
| 14 | heat.tenant_id: 'fc015a00cda344e9b66e3d99e0a0591a' |
| 15 | heat.password: 'cloudlab' |
| 16 | |
| 17 | ''' |
| 18 | |
| 19 | def __virtual__(): |
| 20 | ''' |
| 21 | Only load if the gitlab module is in __salt__ |
| 22 | ''' |
| 23 | return 'heat' if 'python-heatclient' in __salt__ else False |
| 24 | |
| 25 | |
| 26 | def stack_absent(name): |
| 27 | |
| 28 | pass |
| 29 | |
| 30 | def stack_present(name, template_file=None, environment_file=None): |
| 31 | '''' |
| 32 | Enforces stack |
| 33 | |
| 34 | :param:name: The name of the stack to create |
| 35 | :param:template_file: Template file |
| 36 | ''' |
| 37 | |
| 38 | ret = {'name': name, |
| 39 | 'changes': {}, |
| 40 | 'result': True, |
| 41 | 'comment': 'Stack "{0}" already exists'.format(name)} |
| 42 | |
| 43 | # Create project |
| 44 | __salt__['gitlab.project_create'](name, description, enabled, |
| 45 | profile=profile, |
| 46 | **connection_args) |
| 47 | ret['comment'] = 'Tenant "{0}" has been added'.format(name) |
| 48 | ret['changes']['Tenant'] = 'Created' |
| 49 | |
| 50 | return ret |