More friendly message reinstalling a v1.0 plugin.
Now the code is showing a more friendly message to the user, instead of the full resp response. [root@fuel objects]# fuel plugins --install /tmp/lbaas-1.0.0.fp DEPRECATION WARNING: The plugin has old 1.0 package format, this format does not support many features, such as plugins updates, find plugin in new format or migrate and rebuild this one. Nothing to do: LBaaS plugin for Neutron, version 1.0.0, does not update installed plugin. Change-Id: I865c1024bde851bf4873aff4f775b8aac5329d35 Closes-Bug: 1396154
This commit is contained in:
parent
a54da335f1
commit
9db6d71045
|
@ -453,6 +453,11 @@ class Plugins(base.BaseObject):
|
|||
# Replace plugin information
|
||||
url = cls.class_instance_path.format(id=resp['id'])
|
||||
resp = cls.connection.put_request(url, metadata)
|
||||
elif resp_raw.status_code == 409:
|
||||
error.exit_with_error(
|
||||
"Nothing to do: %(title)s, version "
|
||||
"%(package_version)s, does not update "
|
||||
"installed plugin." % metadata)
|
||||
else:
|
||||
resp_raw.raise_for_status()
|
||||
|
||||
|
|
|
@ -346,6 +346,21 @@ class TestPluginsObject(base.UnitTestCase):
|
|||
get_for_update_mock.assert_called_once_with(meta)
|
||||
self.assertFalse(put_mock.called)
|
||||
|
||||
@patch.object(Plugins, 'get_plugin_for_update', return_value=None)
|
||||
@patch.object(Plugins.connection, 'post_request_raw',
|
||||
return_value=MagicMock(
|
||||
status_code=409,
|
||||
**{'json.return_value': {'id': 99}}))
|
||||
@patch.object(Plugins.connection, 'put_request', return_value='put_return')
|
||||
def test_update_or_create_updates_without_force(
|
||||
self, put_mock, post_mock, get_for_update_mock):
|
||||
meta = {'id': 99, 'version': '1.0.0', 'package_version': '2.0.0',
|
||||
'title': 'Plugin title'}
|
||||
self.assertRaises(SystemExit,
|
||||
self.plugin.update_or_create,
|
||||
meta,
|
||||
force=False)
|
||||
|
||||
@patch.object(Plugins, 'get_plugin_for_update', return_value=None)
|
||||
@patch.object(Plugins.connection, 'post_request_raw',
|
||||
return_value=MagicMock(
|
||||
|
|
Loading…
Reference in New Issue