diff options
author | llg8212 <lilinguo@huawei.com> | 2014-02-24 09:32:52 +0800 |
---|---|---|
committer | llg8212 <lilinguo@huawei.com> | 2014-03-18 10:27:55 +0800 |
commit | 9d3d26d903d269a3bbaabde4ddcc411c28fe3f01 (patch) | |
tree | c89e7c491f6c1df5a517ad659f0a84008b4a0e2f /heatclient/v1 | |
parent | 7e265ec757f26bce5038bdcc7fa81abd823e328f (diff) | |
download | python-heatclient-9d3d26d903d269a3bbaabde4ddcc411c28fe3f01.tar.gz |
Remove dependent module py3kcompat
Module py3kcompat was removed from oslo-incubator, we can use
six directly.
* Sync commit of removing py3kcompat from oslo
* use six replace usage of py3kcompat
Change-Id: If0f9397588b2180fe198e804cbbb5b5c8420fe76
Closes-Bug: #1280033
Diffstat (limited to 'heatclient/v1')
-rw-r--r-- | heatclient/v1/events.py | 15 | ||||
-rw-r--r-- | heatclient/v1/resource_types.py | 5 | ||||
-rw-r--r-- | heatclient/v1/resources.py | 20 | ||||
-rw-r--r-- | heatclient/v1/shell.py | 7 | ||||
-rw-r--r-- | heatclient/v1/software_deployments.py | 7 | ||||
-rw-r--r-- | heatclient/v1/stacks.py | 4 |
6 files changed, 28 insertions, 30 deletions
diff --git a/heatclient/v1/events.py b/heatclient/v1/events.py index cb24664..e4cbcfd 100644 --- a/heatclient/v1/events.py +++ b/heatclient/v1/events.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from six.moves.urllib import parse + from heatclient.openstack.common.apiclient import base -from heatclient.openstack.common.py3kcompat import urlutils from heatclient.openstack.common import strutils from heatclient.v1 import stacks @@ -48,10 +49,9 @@ class EventManager(stacks.StackChildManager): url = '/stacks/%s/events' % stack_id else: stack_id = self._resolve_stack_id(stack_id) - # Use urlutils for python2/python3 compatibility url = '/stacks/%s/resources/%s/events' % ( - urlutils.quote(stack_id, ''), - urlutils.quote(strutils.safe_encode(resource_name), '')) + parse.quote(stack_id, ''), + parse.quote(strutils.safe_encode(resource_name), '')) return self._list(url, "events") def get(self, stack_id, resource_name, event_id): @@ -62,10 +62,9 @@ class EventManager(stacks.StackChildManager): :param event_id: ID of event to get the details for """ stack_id = self._resolve_stack_id(stack_id) - # Use urlutils for python2/python3 compatibility url_str = '/stacks/%s/resources/%s/events/%s' % ( - urlutils.quote(stack_id, ''), - urlutils.quote(strutils.safe_encode(resource_name), ''), - urlutils.quote(event_id, '')) + parse.quote(stack_id, ''), + parse.quote(strutils.safe_encode(resource_name), ''), + parse.quote(event_id, '')) resp, body = self.client.json_request('GET', url_str) return Event(self, body['event']) diff --git a/heatclient/v1/resource_types.py b/heatclient/v1/resource_types.py index c3dd3b7..ec2b599 100644 --- a/heatclient/v1/resource_types.py +++ b/heatclient/v1/resource_types.py @@ -11,8 +11,9 @@ # License for the specific language governing permissions and limitations # under the License. +from six.moves.urllib import parse + from heatclient.openstack.common.apiclient import base -from heatclient.openstack.common.py3kcompat import urlutils from heatclient.openstack.common import strutils @@ -42,6 +43,6 @@ class ResourceTypeManager(base.BaseManager): :param resource_type: name of the resource type to get the details for """ url_str = '/resource_types/%s' % ( - urlutils.quote(strutils.safe_encode(resource_type), '')) + parse.quote(strutils.safe_encode(resource_type), '')) resp, body = self.client.json_request('GET', url_str) return body diff --git a/heatclient/v1/resources.py b/heatclient/v1/resources.py index 10dd5f4..a51fb0f 100644 --- a/heatclient/v1/resources.py +++ b/heatclient/v1/resources.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from six.moves.urllib import parse + from heatclient.openstack.common.apiclient import base -from heatclient.openstack.common.py3kcompat import urlutils from heatclient.openstack.common import strutils from heatclient.v1 import stacks @@ -52,10 +53,9 @@ class ResourceManager(stacks.StackChildManager): :param resource_name: ID of resource to get the details for """ stack_id = self._resolve_stack_id(stack_id) - # Use urlutils for python2/python3 compatibility url_str = '/stacks/%s/resources/%s' % ( - urlutils.quote(stack_id, ''), - urlutils.quote(strutils.safe_encode(resource_name), '')) + parse.quote(stack_id, ''), + parse.quote(strutils.safe_encode(resource_name), '')) resp, body = self.client.json_request('GET', url_str) return Resource(self, body['resource']) @@ -66,10 +66,9 @@ class ResourceManager(stacks.StackChildManager): :param resource_name: ID of resource to get metadata for """ stack_id = self._resolve_stack_id(stack_id) - # Use urlutils for python2/python3 compatibility url_str = '/stacks/%s/resources/%s/metadata' % ( - urlutils.quote(stack_id, ''), - urlutils.quote(strutils.safe_encode(resource_name), '')) + parse.quote(stack_id, ''), + parse.quote(strutils.safe_encode(resource_name), '')) resp, body = self.client.json_request('GET', url_str) return body['metadata'] @@ -81,14 +80,13 @@ class ResourceManager(stacks.StackChildManager): """ stack_id = self._resolve_stack_id(stack_id) url_str = '/stacks/%s/resources/%s/signal' % ( - urlutils.quote(stack_id, ''), - urlutils.quote(strutils.safe_encode(resource_name), '')) + parse.quote(stack_id, ''), + parse.quote(strutils.safe_encode(resource_name), '')) resp, body = self.client.json_request('POST', url_str, data=data) return body def generate_template(self, resource_name): - # Use urlutils for python2/python3 compatibility url_str = '/resource_types/%s/template' % ( - urlutils.quote(strutils.safe_encode(resource_name), '')) + parse.quote(strutils.safe_encode(resource_name), '')) resp, body = self.client.json_request('GET', url_str) return body diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index eeb4ca0..0bf33a0 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -14,13 +14,12 @@ # under the License. import logging - +from six.moves.urllib import request import yaml from heatclient.common import template_utils from heatclient.common import utils from heatclient.openstack.common import jsonutils -from heatclient.openstack.common.py3kcompat import urlutils import heatclient.exc as exc @@ -148,7 +147,7 @@ def do_stack_adopt(hc, args): raise exc.CommandError('Need to specify --adopt-file') adopt_url = template_utils.normalise_file_path_to_url(args.adopt_file) - adopt_data = urlutils.urlopen(adopt_url).read() + adopt_data = request.urlopen(adopt_url).read() if args.create_timeout: logger.warning('-c/--create-timeout is deprecated, ' @@ -593,7 +592,7 @@ def do_resource_signal(hc, args): raise exc.CommandError('Can only specify one of data and data-file') if data_file: data_url = template_utils.normalise_file_path_to_url(data_file) - data = urlutils.urlopen(data_url).read() + data = request.urlopen(data_url).read() if data: try: data = jsonutils.loads(data) diff --git a/heatclient/v1/software_deployments.py b/heatclient/v1/software_deployments.py index 4bbdf3d..0f685f2 100644 --- a/heatclient/v1/software_deployments.py +++ b/heatclient/v1/software_deployments.py @@ -10,8 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +from six.moves.urllib import parse + from heatclient.openstack.common.apiclient import base -from heatclient.openstack.common.py3kcompat import urlutils class SoftwareDeployment(base.Resource): @@ -32,7 +33,7 @@ class SoftwareDeploymentManager(base.BaseManager): """Get a list of software deployments. :rtype: list of :class:`SoftwareDeployment` """ - url = '/software_deployments?%s' % urlutils.urlencode(kwargs) + url = '/software_deployments?%s' % parse.urlencode(kwargs) return self._list(url, "software_deployments") def metadata(self, server_id): @@ -40,7 +41,7 @@ class SoftwareDeploymentManager(base.BaseManager): given server. :rtype: list of :class:`SoftwareDeployment` """ - url = '/software_deployments/metadata/%s' % urlutils.quote( + url = '/software_deployments/metadata/%s' % parse.quote( server_id, '') resp, body = self.client.json_request('GET', url) return body['metadata'] diff --git a/heatclient/v1/stacks.py b/heatclient/v1/stacks.py index 2d1ba6d..d918ba5 100644 --- a/heatclient/v1/stacks.py +++ b/heatclient/v1/stacks.py @@ -14,9 +14,9 @@ # under the License. import six +from six.moves.urllib import parse from heatclient.openstack.common.apiclient import base -from heatclient.openstack.common.py3kcompat import urlutils class Stack(base.Resource): @@ -78,7 +78,7 @@ class StackManager(base.BaseManager): def paginate(params): '''Paginate stacks, even if more than API limit.''' current_limit = int(params.get('limit') or 0) - url = '/stacks?%s' % urlutils.urlencode(params, True) + url = '/stacks?%s' % parse.urlencode(params, True) stacks = self._list(url, 'stacks') for stack in stacks: yield stack |