from snaps import file_utils
from snaps.domain.stack import Stack, Resource, Output
-from snaps.openstack.utils import keystone_utils, neutron_utils, nova_utils, \
- cinder_utils
+from snaps.openstack.utils import (
+ keystone_utils, neutron_utils, nova_utils, cinder_utils)
__author__ = 'spisarski'
:param os_creds: the OpenStack credentials
:return: the client
"""
- logger.debug('Retrieving Nova Client')
+ logger.debug('Retrieving Heat Client')
return Client(os_creds.heat_api_version,
session=keystone_utils.keystone_session(os_creds),
region_name=os_creds.region_name)
if ((res_type and os_resource.resource_type == res_type)
or not res_type):
out.append(Resource(
+ name=os_resource.resource_name,
resource_type=os_resource.resource_type,
- resource_id=os_resource.physical_resource_id))
+ resource_id=os_resource.physical_resource_id,
+ status=os_resource.resource_status,
+ status_reason=os_resource.resource_status_reason))
return out
return out
+def get_stack_security_groups(heat_cli, neutron, stack):
+ """
+ Returns a list of SecurityGroup domain objects deployed by this stack
+ :param heat_cli: the OpenStack heat client object
+ :param neutron: the OpenStack neutron client object
+ :param stack: the SNAPS-OO Stack domain object
+ :return: a list of SecurityGroup objects
+ """
+
+ out = list()
+ resources = get_resources(heat_cli, stack, 'OS::Neutron::SecurityGroup')
+ for resource in resources:
+ security_group = neutron_utils.get_security_group_by_id(
+ neutron, resource.id)
+ if security_group:
+ out.append(security_group)
+
+ return out
+
+
def get_stack_servers(heat_cli, nova, stack):
"""
Returns a list of VMInst domain objects associated with a Stack