예제 #1
0
 def destroy(self, category, extras):
     """
     Deletes the specified security group.
     """
     context = extras['nova_ctx']
     security_group = security.retrieve_group_by_name(
         category.term, extras['nova_ctx'])
     security.remove_group(security_group, context)
예제 #2
0
파일: openstack.py 프로젝트: IFCA/occi-os
 def destroy(self, category, extras):
     """
     Deletes the specified security group.
     """
     context = extras['nova_ctx']
     security_group = security.retrieve_group_by_name(category.term,
                                                      extras['nova_ctx'])
     security.remove_group(security_group, context)
예제 #3
0
파일: openstack.py 프로젝트: ic-hep/occi-os
    def create(self, entity, extras):
        """
        Creates a security rule.
        The group to add the rule to must exist.
        In OCCI-speak this means the mixin must be supplied with the request
        """
        sec_mixin = get_sec_mixin(entity)
        context = extras['nova_ctx']
        security_group = security.retrieve_group_by_name(sec_mixin.term,
                                                         context)
        sg_rule = make_sec_rule(entity, security_group['id'])

        if security_group_rule_exists(security_group, sg_rule):
            # This rule already exists in group
            msg = 'This rule already exists in group. %s' %\
                  str(security_group)
            raise AttributeError(msg)

        security.create_rule(sec_mixin.term, security_group['id'], [sg_rule],
                             context)
예제 #4
0
    def create(self, entity, extras):
        """
        Creates a security rule.
        The group to add the rule to must exist.
        In OCCI-speak this means the mixin must be supplied with the request
        """
        sec_mixin = get_sec_mixin(entity)
        context = extras['nova_ctx']
        security_group = security.retrieve_group_by_name(
            sec_mixin.term, context)
        sg_rule = make_sec_rule(entity, security_group['id'])

        if security_group_rule_exists(security_group, sg_rule):
            #This rule already exists in group
            msg = 'This rule already exists in group. %s' %\
                  str(security_group)
            raise AttributeError(msg)

        security.create_rule(sec_mixin.term, security_group['id'], [sg_rule],
                             context)