Skip to content

Commit 200c493

Browse files
committed
Merge branch 'release-v5.5.1'
2 parents ee1e161 + d6db64d commit 200c493

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

netfoundry/ctl.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def main(cli):
7878
@cli.argument('-s','--shell', help=argparse.SUPPRESS, arg_only=True, action="store_true", default=False)
7979
@cli.argument('-v','--ziti-version', help=argparse.SUPPRESS, default='0.22.0') # minium ziti CLI version supports --cli-identity and --read-only
8080
@cli.argument('-c','--ziti-cli', help=argparse.SUPPRESS)
81-
@cli.subcommand('login to a management API', hidden=True)
81+
@cli.subcommand('login to a management API')
8282
def login(cli, api: str=None, shell: bool=None):
8383
"""Login to an API and cache the expiring token."""
8484
if api:
@@ -116,7 +116,7 @@ def login(cli, api: str=None, shell: bool=None):
116116
network, network_group = None, None
117117

118118
summary_object = dict()
119-
summary_object['caller'] = whoami(cli, echo=False, organization=organization)
119+
summary_object['caller'] = organization.caller
120120
summary_object['organization'] = organization.describe
121121
if network_group:
122122
summary_object['network_group'] = network_group.describe
@@ -263,22 +263,6 @@ def logout(cli):
263263
cli.log.error("failed to logout with %s", e)
264264
exit(1)
265265

266-
@cli.subcommand('get caller identity')
267-
def whoami(cli, echo: bool=True, organization: object=None):
268-
"""Get caller identity."""
269-
if organization is None:
270-
organization = use_organization()
271-
caller = organization.caller
272-
caller['label'] = organization.label
273-
caller['environment'] = organization.environment
274-
if echo:
275-
if cli.config.general.output in ["yaml","text"]:
276-
cli.echo(yaml_dumps(caller, indent=4, default_flow_style=False))
277-
elif cli.config.general.output == "json":
278-
cli.echo(json_dumps(caller, indent=4))
279-
else:
280-
return caller
281-
282266
@cli.argument('-f', '--file', help='JSON or YAML file', type=argparse.FileType('r', encoding='UTF-8'))
283267
@cli.argument('-w','--wait', help='seconds to wait for process execution to finish', default=0)
284268
@cli.argument('resource_type', arg_only=True, help='type of resource', choices=[singular(type) for type in NETWORK_RESOURCES.keys()])
@@ -391,6 +375,8 @@ def get(cli, echo: bool=True):
391375
elif cli.args.resource_type == "identity":
392376
if 'id' in cli.args.query.keys():
393377
match = organization.get_identity(identity_id=cli.args.query['id'])
378+
elif not cli.args.query.keys():
379+
match = organization.caller
394380
else:
395381
matches = organization.get_identities(**cli.args.query)
396382
if len(matches) == 1:
@@ -521,7 +507,7 @@ def list(cli):
521507
# and the set of configured, desired keys
522508
valid_keys = set(matches[0].keys()) & set(cli.args.keys)
523509
elif cli.config.general.output == "text":
524-
valid_keys = set(matches[0].keys()) & set(['name','label','organizationShortName','id','edgeRouterAttributes','serviceAttributes','endpointAttributes','status','zitiId','provider','locationCode','ipAddress','region','size','attributes'])
510+
valid_keys = set(matches[0].keys()) & set(['name','label','organizationShortName','id','edgeRouterAttributes','serviceAttributes','endpointAttributes','status','zitiId','provider','locationCode','ipAddress','region','size','attributes','email'])
525511

526512
if valid_keys:
527513
cli.log.debug("valid keys: %s", str(valid_keys))

0 commit comments

Comments
 (0)