summaryrefslogtreecommitdiff
path: root/openstackclient/compute/v2
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2014-09-18 00:55:58 -0500
committerDean Troyer <dtroyer@gmail.com>2017-04-11 02:08:04 -0500
commit4289ddd47a9c92eb3033eccf39966915caae05db (patch)
tree691754545d754da44af2d6f0d78002abb1a02410 /openstackclient/compute/v2
parent09286ad8583bb7771b2ca4e9bed23a90056687d6 (diff)
downloadpython-openstackclient-4289ddd47a9c92eb3033eccf39966915caae05db.tar.gz
Low-level Compute v2 API: security group
api.compute.APIv2 starts with security group functions. novaclient 8.0 is now released without support for the previously deprecated nova-net functions, so include a new low-level REST implementation of the removed APIs. Change-Id: Id007535f0598226a8202716232313e37fe6247f9
Diffstat (limited to 'openstackclient/compute/v2')
-rw-r--r--openstackclient/compute/v2/server.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index ae839677..7cd4588b 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -22,6 +22,7 @@ import logging
import os
import sys
+from novaclient.v2 import servers
from osc_lib.cli import parseractions
from osc_lib.command import command
from osc_lib import exceptions
@@ -29,11 +30,6 @@ from osc_lib import utils
from oslo_utils import timeutils
import six
-try:
- from novaclient.v2 import servers
-except ImportError:
- from novaclient.v1_1 import servers
-
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
@@ -316,12 +312,11 @@ class AddServerSecurityGroup(command.Command):
compute_client.servers,
parsed_args.server,
)
- security_group = utils.find_resource(
- compute_client.security_groups,
+ security_group = compute_client.api.security_group_find(
parsed_args.group,
)
- server.add_security_group(security_group.id)
+ server.add_security_group(security_group['id'])
class AddServerVolume(command.Command):
@@ -1437,12 +1432,11 @@ class RemoveServerSecurityGroup(command.Command):
compute_client.servers,
parsed_args.server,
)
- security_group = utils.find_resource(
- compute_client.security_groups,
+ security_group = compute_client.api.security_group_find(
parsed_args.group,
)
- server.remove_security_group(security_group.id)
+ server.remove_security_group(security_group['id'])
class RemoveServerVolume(command.Command):