diff options
Diffstat (limited to 'moonclient')
-rw-r--r-- | moonclient/moonclient/shell.py | 3 | ||||
-rw-r--r-- | moonclient/moonclient/tests.py | 8 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_subjects.json | 10 |
3 files changed, 9 insertions, 12 deletions
diff --git a/moonclient/moonclient/shell.py b/moonclient/moonclient/shell.py index 4073a227..8343d86e 100644 --- a/moonclient/moonclient/shell.py +++ b/moonclient/moonclient/shell.py @@ -165,6 +165,8 @@ class MoonClient(App): pass content = resp.read() conn.close() + if len(content) == 0: + return {} try: content = json.loads(content) if "error" in content: @@ -180,7 +182,6 @@ class MoonClient(App): return content except ValueError: raise Exception("Getting an error while requiring {} ({})".format(url, content)) - # return {"content": content} def auth_keystone(self, username=None, password=None, host=None, port=None): """Send a new authentication request to Keystone diff --git a/moonclient/moonclient/tests.py b/moonclient/moonclient/tests.py index 6484009f..e85c276b 100644 --- a/moonclient/moonclient/tests.py +++ b/moonclient/moonclient/tests.py @@ -110,15 +110,11 @@ class TestsLaunch(Lister): if "external_command" in test: ext_command = test["external_command"] else: - ext_command = test["shell_command"] + continue ext_command = self.__replace_var_in_str(ext_command) self.logfile.write("-----> {}\n".format(ext_command)) self.log.info(" \\-executing external \"{}\"".format(ext_command)) - if "external_command" in test: - pipe = subprocess.Popen(shlex.split(ext_command), stdout=subprocess.PIPE, stderr=subprocess.PIPE) - else: - # Note (asteroide): security hazard! Must reduce the possible commands here. - pipe = subprocess.Popen(ext_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + pipe = subprocess.Popen(shlex.split(ext_command), stdout=subprocess.PIPE, stderr=subprocess.PIPE) com = pipe.communicate() result_str = com[0] error_str = com[1] diff --git a/moonclient/moonclient/tests/tests_subjects.json b/moonclient/moonclient/tests/tests_subjects.json index 7001e227..37d37f42 100644 --- a/moonclient/moonclient/tests/tests_subjects.json +++ b/moonclient/moonclient/tests/tests_subjects.json @@ -36,7 +36,7 @@ }, { "name": "set_tenant_authz", - "command": "tenant set --authz $uuid_authz alt_demo", + "command": "tenant set --authz $uuid_authz $uuid", "result": "", "description": "Connect the authz intra extension to the tenant alt_demo", "command_options": "" @@ -57,9 +57,9 @@ }, { "name": "add_subject", - "command": "subject add alt_demo", + "command": "subject add alt_demo --password nomoresecrete", "result": "", - "description": "Connect the authz intra extension to the tenant demo", + "description": "Add the alt_demo subject", "command_options": "" }, { @@ -186,9 +186,9 @@ }, { "name": "add_subject", - "command": "subject add alt_demo", + "command": "subject add alt_demo --password nomoresecrete", "result": "", - "description": "Connect the authz intra extension to the tenant alt_demo", + "description": "Add the alt_demo subject", "command_options": "" }, { |