Fix several errors:

* Invalid content type: application/json.
  Expected: application/json-patch+json.

* 'Controller' object has no attribute 'reactivete'/'deactivete'.

Change-Id: I07b13dbe357307911006237cddb2a7e6a35f0255
This commit is contained in:
Darja Malyavkina 2016-09-19 12:50:41 +03:00
parent 6005eb8b3b
commit 9badd14b77
2 changed files with 3 additions and 9 deletions

View File

@ -72,18 +72,12 @@ class _BaseHTTPClient(object):
# Default Content-Type is octet-stream
content_type = headers.get('Content-Type', 'application/octet-stream')
# NOTE(jamielennox): remove this later. Managers should pass json= if
# they want to send json data.
data = kwargs.pop("data", None)
if data is not None and not isinstance(data, six.string_types):
try:
data = json.dumps(data)
content_type = 'application/json'
content_type = content_type or 'application/json'
except TypeError:
# Here we assume it's
# a file-like object
# and we'll chunk it
data = self._chunk_body(data)
headers['Content-Type'] = content_type

View File

@ -287,7 +287,7 @@ class DeactivateArtifact(command.ShowOne):
def take_action(self, parsed_args):
LOG.debug('take_action({0})'.format(parsed_args))
client = self.app.client_manager.artifact
data = client.artifacts.deactivete(parsed_args.id,
data = client.artifacts.deactivate(parsed_args.id,
type_name=parsed_args.type_name)
return self.dict2columns(data)
@ -313,7 +313,7 @@ class ReactivateArtifact(command.ShowOne):
def take_action(self, parsed_args):
LOG.debug('take_action({0})'.format(parsed_args))
client = self.app.client_manager.artifact
data = client.artifacts.reactivete(parsed_args.id,
data = client.artifacts.reactivate(parsed_args.id,
type_name=parsed_args.type_name)
return self.dict2columns(data)