summaryrefslogtreecommitdiff
path: root/heatclient
diff options
context:
space:
mode:
Diffstat (limited to 'heatclient')
-rw-r--r--heatclient/_i18n.py2
-rw-r--r--heatclient/common/http.py5
-rw-r--r--heatclient/common/template_format.py17
-rw-r--r--heatclient/osc/plugin.py4
-rw-r--r--heatclient/tests/functional/osc/v1/base.py5
-rw-r--r--heatclient/tests/functional/osc/v1/test_stack.py7
-rw-r--r--heatclient/tests/unit/test_shell.py34
-rw-r--r--heatclient/tests/unit/test_utils.py3
-rw-r--r--heatclient/v1/stacks.py2
9 files changed, 52 insertions, 27 deletions
diff --git a/heatclient/_i18n.py b/heatclient/_i18n.py
index f8c6269..4abe87e 100644
--- a/heatclient/_i18n.py
+++ b/heatclient/_i18n.py
@@ -12,7 +12,7 @@
"""oslo.i18n integration module.
-See http://docs.openstack.org/developer/oslo.i18n/usage.html
+See https://docs.openstack.org/oslo.i18n/latest/user/index.html
"""
diff --git a/heatclient/common/http.py b/heatclient/common/http.py
index 4b765df..bb2f0c1 100644
--- a/heatclient/common/http.py
+++ b/heatclient/common/http.py
@@ -137,7 +137,10 @@ class HTTPClient(object):
if 'data' in kwargs:
curl.append('-d \'%s\'' % kwargs['data'])
- curl.append('%s%s' % (self.endpoint, url))
+ if not parse.urlparse(url).netloc:
+ url = self.endpoint + url
+
+ curl.append(url)
LOG.debug(' '.join(curl))
@staticmethod
diff --git a/heatclient/common/template_format.py b/heatclient/common/template_format.py
index f73339f..fb275f6 100644
--- a/heatclient/common/template_format.py
+++ b/heatclient/common/template_format.py
@@ -16,14 +16,23 @@ import yaml
from heatclient._i18n import _
if hasattr(yaml, 'CSafeLoader'):
- yaml_loader = yaml.CSafeLoader
+ yaml_loader_base = yaml.CSafeLoader
else:
- yaml_loader = yaml.SafeLoader
+ yaml_loader_base = yaml.SafeLoader
if hasattr(yaml, 'CSafeDumper'):
- yaml_dumper = yaml.CSafeDumper
+ yaml_dumper_base = yaml.CSafeDumper
else:
- yaml_dumper = yaml.SafeDumper
+ yaml_dumper_base = yaml.SafeDumper
+
+
+# We create custom class to not overriden the default yaml behavior
+class yaml_loader(yaml_loader_base):
+ pass
+
+
+class yaml_dumper(yaml_dumper_base):
+ pass
def _construct_yaml_str(self, node):
diff --git a/heatclient/osc/plugin.py b/heatclient/osc/plugin.py
index 8bc3f15..859a13e 100644
--- a/heatclient/osc/plugin.py
+++ b/heatclient/osc/plugin.py
@@ -41,13 +41,15 @@ def make_client(instance):
if instance.session:
kwargs.update({'session': instance.session,
'service_type': API_NAME})
+ elif instance.auth_plugin_name == 'token_endpoint':
+ kwargs.update({'endpoint': instance.auth.url,
+ 'token': instance.auth.token})
else:
endpoint = instance.get_endpoint_for_service_type(
API_NAME,
region_name=instance.region_name,
interface=instance.interface,
)
-
kwargs.update({'endpoint': endpoint,
'auth_url': instance.auth.auth_url,
'username': instance.auth_ref.username,
diff --git a/heatclient/tests/functional/osc/v1/base.py b/heatclient/tests/functional/osc/v1/base.py
index b17fb4c..c9a946e 100644
--- a/heatclient/tests/functional/osc/v1/base.py
+++ b/heatclient/tests/functional/osc/v1/base.py
@@ -114,3 +114,8 @@ class OpenStackClientTestBase(base.ClientTestBase):
def _stack_snapshot_restore(self, id, snapshot_id):
cmd = 'stack snapshot restore ' + id + ' ' + snapshot_id
self.openstack(cmd)
+
+ def _stack_show(self, stack_id):
+ cmd = 'stack show ' + stack_id
+ stack_raw = self.openstack(cmd)
+ return self.show_to_dict(stack_raw)
diff --git a/heatclient/tests/functional/osc/v1/test_stack.py b/heatclient/tests/functional/osc/v1/test_stack.py
index 2f985f7..d5bc653 100644
--- a/heatclient/tests/functional/osc/v1/test_stack.py
+++ b/heatclient/tests/functional/osc/v1/test_stack.py
@@ -75,3 +75,10 @@ class OpenStackClientStackTest(base.OpenStackClientTestBase):
stacks_raw = self.openstack(
'stack snapshot list' + ' ' + self.stack_name)
self.assertNotIn(snapshot['id'], stacks_raw)
+
+ def test_stack_show(self):
+ stack = self._stack_create_minimal()
+ stack_info = self._stack_show(stack['id'])
+ stack_props = {k: v for k, v in stack_info.items()
+ if k in stack.keys()}
+ self.assertEqual(stack, stack_props)
diff --git a/heatclient/tests/unit/test_shell.py b/heatclient/tests/unit/test_shell.py
index 175eda1..2ea4fd4 100644
--- a/heatclient/tests/unit/test_shell.py
+++ b/heatclient/tests/unit/test_shell.py
@@ -774,7 +774,7 @@ class ShellTestUserPass(ShellBase):
]
for r in required:
self.assertRegex(list_text, r)
- self.assertNotRegexpMatches(list_text, 'parent')
+ self.assertNotRegex(list_text, 'parent')
def test_stack_list_show_nested(self):
self.register_keystone_auth_fixture()
@@ -2918,7 +2918,7 @@ class ShellTestEventsNested(ShellBase):
for r in required:
self.assertRegex(list_text, r)
- self.assertNotRegexpMatches(list_text, 'p_eventid1')
+ self.assertNotRegex(list_text, 'p_eventid1')
self.assertRegex(list_text,
"%s.*\n.*%s.*\n.*%s.*" % timestamps[1:])
@@ -2942,8 +2942,8 @@ class ShellTestEventsNested(ShellBase):
'stack_name', 'teststack', 'nested']
for r in required:
self.assertRegex(list_text, r)
- self.assertNotRegexpMatches(list_text, 'p_eventid2')
- self.assertNotRegexpMatches(list_text, 'n_eventid2')
+ self.assertNotRegex(list_text, 'p_eventid2')
+ self.assertNotRegex(list_text, 'n_eventid2')
self.assertRegex(list_text,
"%s.*\n.*%s.*\n" % timestamps[:2])
@@ -3121,9 +3121,9 @@ class ShellTestHookFunctions(ShellBase):
required = ['id', 'p_eventid2', 'stack_name', 'teststack', hook_reason]
for r in required:
self.assertRegex(list_text, r)
- self.assertNotRegexpMatches(list_text, 'p_eventid1')
- self.assertNotRegexpMatches(list_text, 'n_eventid1')
- self.assertNotRegexpMatches(list_text, 'n_eventid2')
+ self.assertNotRegex(list_text, 'p_eventid1')
+ self.assertNotRegex(list_text, 'n_eventid1')
+ self.assertNotRegex(list_text, 'n_eventid2')
def test_hook_poll_pre_update(self):
self.register_keystone_auth_fixture()
@@ -3136,9 +3136,9 @@ class ShellTestHookFunctions(ShellBase):
required = ['id', 'p_eventid2', 'stack_name', 'teststack', hook_reason]
for r in required:
self.assertRegex(list_text, r)
- self.assertNotRegexpMatches(list_text, 'p_eventid1')
- self.assertNotRegexpMatches(list_text, 'n_eventid1')
- self.assertNotRegexpMatches(list_text, 'n_eventid2')
+ self.assertNotRegex(list_text, 'p_eventid1')
+ self.assertNotRegex(list_text, 'n_eventid1')
+ self.assertNotRegex(list_text, 'n_eventid2')
def test_hook_poll_pre_delete(self):
self.register_keystone_auth_fixture()
@@ -3151,9 +3151,9 @@ class ShellTestHookFunctions(ShellBase):
required = ['id', 'p_eventid2', 'stack_name', 'teststack', hook_reason]
for r in required:
self.assertRegex(list_text, r)
- self.assertNotRegexpMatches(list_text, 'p_eventid1')
- self.assertNotRegexpMatches(list_text, 'n_eventid1')
- self.assertNotRegexpMatches(list_text, 'n_eventid2')
+ self.assertNotRegex(list_text, 'p_eventid1')
+ self.assertNotRegex(list_text, 'n_eventid1')
+ self.assertNotRegex(list_text, 'n_eventid2')
def test_hook_poll_bad_status(self):
self.register_keystone_auth_fixture()
@@ -3887,13 +3887,13 @@ class ShellTestDeployment(ShellBase):
]
for r in required:
self.assertRegex(list_text, r)
- self.assertNotRegexpMatches(list_text, 'parent')
+ self.assertNotRegex(list_text, 'parent')
list_text = self.shell('deployment-list -s 123')
for r in required:
self.assertRegex(list_text, r)
- self.assertNotRegexpMatches(list_text, 'parent')
+ self.assertNotRegex(list_text, 'parent')
def test_deploy_show(self):
self.register_keystone_auth_fixture()
@@ -4227,7 +4227,7 @@ class ShellTestStandaloneToken(ShellTestUserPass):
]
for r in required:
self.assertRegex(list_text, r)
- self.assertNotRegexpMatches(list_text, 'parent')
+ self.assertNotRegex(list_text, 'parent')
class MockShellBase(TestCase):
@@ -4308,7 +4308,7 @@ class MockShellTestUserPass(MockShellBase):
]
for r in required:
self.assertRegex(list_text, r)
- self.assertNotRegexpMatches(list_text, 'parent')
+ self.assertNotRegex(list_text, 'parent')
if self.jreq_mock.call_args is None:
self.assertEqual(1, self.session_jreq_mock.call_count)
diff --git a/heatclient/tests/unit/test_utils.py b/heatclient/tests/unit/test_utils.py
index 3491816..0cb1462 100644
--- a/heatclient/tests/unit/test_utils.py
+++ b/heatclient/tests/unit/test_utils.py
@@ -415,8 +415,7 @@ class TestURLFunctions(testtools.TestCase):
tmpl_url)
self.assertEqual(utils.get_template_url(None, tmpl_url),
tmpl_url)
- self.assertEqual(utils.get_template_url(None, None),
- None)
+ self.assertIsNone(utils.get_template_url(None, None))
def test_base_url_for_url(self):
self.assertEqual(
diff --git a/heatclient/v1/stacks.py b/heatclient/v1/stacks.py
index 1a76286..2484ff4 100644
--- a/heatclient/v1/stacks.py
+++ b/heatclient/v1/stacks.py
@@ -279,7 +279,7 @@ class StackManager(StackChildManager):
kwargs['params'] = {"resolve_outputs": False}
resp = self.client.get('/stacks/%s' % stack_id, **kwargs)
body = utils.get_response_body(resp)
- return Stack(self, body.get('stack'))
+ return Stack(self, body.get('stack'), loaded=True)
def template(self, stack_id):
"""Get template content for a specific stack as a parsed JSON object.