Switch to the value format for keystone check.
JSON output can be from cliff or clifftab. This patch switches to the value format to avoid this problem. Change-Id: I5670c3f3d9b41cbe4ce424d548c573cf17770760 Closes-bug: 1533791
This commit is contained in:
parent
21f28d4670
commit
123838128d
|
@ -19,17 +19,13 @@
|
|||
# under the License.
|
||||
|
||||
from oschecks import utils
|
||||
import json
|
||||
|
||||
|
||||
def _check_keystone_api():
|
||||
keystone = utils.Keystone()
|
||||
|
||||
def check_token():
|
||||
try:
|
||||
return json.loads(keystone.run())['id']
|
||||
except ValueError:
|
||||
return ''
|
||||
return keystone.run().strip()
|
||||
|
||||
elapsed, token = utils.timeit(check_token)
|
||||
if not token:
|
||||
|
|
|
@ -252,12 +252,12 @@ class Keystone(object):
|
|||
|
||||
|
||||
def run(self):
|
||||
jformat = ['-f', 'json']
|
||||
vformat = ['-f', 'value', '-c', 'id']
|
||||
command = ['token', 'issue']
|
||||
jempty = '{"id": ""}'
|
||||
vempty = ''
|
||||
if 'help' in sys.argv or '--help' in sys.argv or '-h' in sys.argv or len(sys.argv[1:]) == 0:
|
||||
t = self.shell.run(command)
|
||||
return jempty
|
||||
self.shell.run(command)
|
||||
return vempty
|
||||
else:
|
||||
self.cmd = self.shell.run(sys.argv[1:] + command + jformat)
|
||||
return self.shell.stdout.getvalue() or jempty
|
||||
self.cmd = self.shell.run(sys.argv[1:] + command + vformat)
|
||||
return self.shell.stdout.getvalue() or vempty
|
||||
|
|
Loading…
Reference in New Issue