

def take_action(self, parsed_args):
    compute_client = self.app.client_manager.compute
    result = 0
    for group in parsed_args.server_group:
        try:
            group_obj = utils.find_resource(compute_client.server_groups, group)
            compute_client.server_groups.delete(group_obj.id)
        except Exception as e:
            result += 1
            self.app.log.error(e)
    if (result > 0):
        total = len(parsed_args.server_group)
        msg = ('%s of %s server groups failed to delete.' % (result, total))
        raise exceptions.CommandError(msg)

dataset/ETHPy150Open dtroyer/python-openstackclient/openstackclient/compute/v2/server_group.py DeleteServerGroup.take_action/original