Lookup path handled in the fuel2
Show lookup parameter added to 'config get' command Change-Id: I889139c015e469c9b6a5350b7048f8f74062cba0 Closes-Bug: #1623898
This commit is contained in:
parent
db53fcb187
commit
d586b3a7cd
@ -64,12 +64,21 @@ class Get(show.ShowOne, ResourcesCommand):
|
||||
type=str,
|
||||
help="Name of key to get from the resource",
|
||||
)
|
||||
parser.add_argument(
|
||||
'-s', '--show-lookup',
|
||||
dest='show_lookup',
|
||||
help="Show lookup path for the value in the result",
|
||||
action='store_true'
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
params = {'effective': True}
|
||||
if parsed_args.show_lookup:
|
||||
params['show_lookup'] = True
|
||||
response = self.get_client().get(
|
||||
self.get_resource_url(parsed_args),
|
||||
params='effective',
|
||||
params=params
|
||||
)
|
||||
key = parsed_args.key
|
||||
if key is not None:
|
||||
|
@ -53,6 +53,11 @@ class TestGet(testscenarios.WithScenarios, _BaseCLITest):
|
||||
'get --env 1 --resource 1 --format=json',
|
||||
'{\n "hello": "world"\n}',
|
||||
)),
|
||||
('global,lookup', (
|
||||
'/environments/1/resources/1/values?effective',
|
||||
'get --env 1 --resource 1 --format=json --show-lookup',
|
||||
'{\n "hello": "world"\n}',
|
||||
)),
|
||||
('lowlevel,json', (
|
||||
'/environments/1/lvl1/value1/resources/1/values?effective',
|
||||
'get --env 1 --level lvl1=value1 --resource 1 --format=json',
|
||||
@ -73,6 +78,11 @@ class TestGet(testscenarios.WithScenarios, _BaseCLITest):
|
||||
'get --env 1 --resource 1 --key hello --format json',
|
||||
'{\n "hello": "world"\n}',
|
||||
)),
|
||||
('key,lookup', (
|
||||
'/environments/1/resources/1/values?effective',
|
||||
'get --env 1 --resource 1 --key hello --format json -s',
|
||||
'{\n "hello": "world"\n}',
|
||||
)),
|
||||
('key,yaml', (
|
||||
'/environments/1/resources/1/values?effective',
|
||||
'get --env 1 --resource 1 --key hello --format yaml',
|
||||
|
Loading…
x
Reference in New Issue
Block a user