Skip to content

Commit

Permalink
YAPF formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mwvaughn committed Apr 22, 2021
1 parent 18e0b5c commit 13e87be
Show file tree
Hide file tree
Showing 40 changed files with 95 additions and 85 deletions.
5 changes: 3 additions & 2 deletions tapis_cli/clients/services/taccapis/v2/apiclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,15 @@ def key_values(self):
except Exception:
profile = self.tapis_client.profiles.get()


for k in profile_vars:
api[k] = profile.get(k, None)
api['full_name'] = '{0} {1}'.format(api['first_name'],
api['last_name'])

except Exception:
logging.warning('Failed to resolve variables {0}. This is usually a side effect of impersonation under Tapis v2.'.format(profile_vars))
logging.warning(
'Failed to resolve variables {0}. This is usually a side effect of impersonation under Tapis v2.'
.format(profile_vars))

# Implement legacy 'agave' template variables
api['agave'] = copy.copy(api)
Expand Down
4 changes: 2 additions & 2 deletions tapis_cli/commands/taccapis/model/v2/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Permission(TapisModel):
}

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("username", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, True),
("permission", argtype.OBJECT, Verbosity.LISTING,
Expand Down Expand Up @@ -88,7 +88,7 @@ class AbacoPermission(TapisModel):
NAMES = ['READ', 'EXECUTE', 'UPDATE', 'NONE']

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("result", argtype.ARRAY, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, True),
("message", argtype.OBJECT, Verbosity.LISTING, argmod.STRING_DEFAULTS,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/actors/execs_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def take_action(self, parsed_args):
actorId=actor_id, **self.client_extra_args)
# custom headers to print all the execution id and status for a
# given actor id
execs_result = results.get('executions') # returns a list
execs_result = results.get('executions') # returns a list
headers = ["executionId", "status"]

records = []
Expand Down
32 changes: 18 additions & 14 deletions tapis_cli/commands/taccapis/v2/apim/auth_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ def get_parser(self, prog_name):
dest='password',
help='{0} password'.format(PLATFORM))

parser.add_argument('--client-name',
dest='client_name',
help='{0} client name. Leave empty to auto-generate.'.format(PLATFORM))
parser.add_argument(
'--client-name',
dest='client_name',
help='{0} client name. Leave empty to auto-generate.'.format(
PLATFORM))

parser = RegistryOpts.extend_parser(parser)
parser = GitServerOpts.extend_parser(parser)
Expand Down Expand Up @@ -206,7 +208,7 @@ def take_action(self, parsed_args):
mandate_password = True
logger.info('Username changed. Password will be required.')
ag_context['username'] = parsed_username

# Process --password argument
if parsed_password is not None:
ag_context['password'] = parsed_password
Expand Down Expand Up @@ -301,13 +303,13 @@ def take_action(self, parsed_args):

# Formulate a table view of key values for current session
headers = [
'tenant_id', 'username', 'api_key', 'access_token',
'expires_at', 'verify'
'tenant_id', 'username', 'api_key', 'access_token', 'expires_at',
'verify'
]
data = [
# Coerce to string to avoid failures where a deepcopy
# operation in Python's implementation of tuple() is
# unable to accomodate copying properties of an Agave object
# Coerce to string to avoid failures where a deepcopy
# operation in Python's implementation of tuple() is
# unable to accomodate copying properties of an Agave object
str(ag.tenant_id),
str(ag.username),
str(ag.api_key),
Expand All @@ -316,19 +318,21 @@ def take_action(self, parsed_args):
str(ag.verify)
]

# Show client name only if specified. Otherwise, end user really does
# Show client name only if specified. Otherwise, end user really does
# not need to see it
if parsed_client_name:
headers.append('client_name')
data.append(ag_context['client_name'])

# Extend headers and data with docker and git workflows
if not parsed_args.no_registry:
(headers, data) = registry.init.interactive(parsed_args, headers, data,
mandate_git_reg)
(headers,
data) = registry.init.interactive(parsed_args, headers, data,
mandate_git_reg)
if not parsed_args.no_git:
(headers, data) = gitserver.init.interactive(parsed_args, headers,
data, mandate_git_reg)
(headers,
data) = gitserver.init.interactive(parsed_args, headers, data,
mandate_git_reg)

et.phone_home()
return (tuple(headers), tuple(data))
6 changes: 3 additions & 3 deletions tapis_cli/commands/taccapis/v2/apim/auth_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def take_action(self, parsed_args):
'refresh_token'
]
data = [
# Coerce to string to avoid failures where a deepcopy
# operation in Python's implementation of tuple() is
# unable to accomodate copying properties of an Agave object
# Coerce to string to avoid failures where a deepcopy
# operation in Python's implementation of tuple() is
# unable to accomodate copying properties of an Agave object
ag_context['tenant_id'],
ag_context['username'],
ag_context['api_key'],
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/apim/models/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Token(TapisModel):
id_display_name = 'TOKEN'

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("scope", argtype.STRING, Verbosity.RECORD, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, False),
("token_type", argtype.STRING, Verbosity.RECORD,
Expand Down
3 changes: 2 additions & 1 deletion tapis_cli/commands/taccapis/v2/apim/registry/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class RegistryOpts(ParserExtender):
def extend_parser(parser):
"""Configures a Command to accept container registry config
"""
reg_group = parser.add_argument_group('Container Registry Access (Optional)')
reg_group = parser.add_argument_group(
'Container Registry Access (Optional)')
reg_group.add_argument('--registry-url',
metavar='URL',
help='Registry URL')
Expand Down
10 changes: 5 additions & 5 deletions tapis_cli/commands/taccapis/v2/apps/deploy/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ def take_action(self, parsed_args):
# Force a tag to be app.version if does not exist
if self.config.get('docker', {}).get('tag', None) is None:
self.config['docker']['tag'] = self.config['app']['version']
# Force population of docker config even if we don't build or

# Force population of docker config even if we don't build or
# push the container in the current invocation of the deploy
# command.
# command.
self.docker_repo_string = self._repo_tag()

# If Dockerfile is not present, turn off container workflow
Expand Down Expand Up @@ -280,11 +280,11 @@ def _repo_tag(self):
repo = repo + ':' + tag

# Provide backwards compatibility for {{docker.organization}},
# {{docker.namespace}} and {{docker.username}} when templating
# {{docker.namespace}} and {{docker.username}} when templating
# out app.json on deployment
#
# I am not sure this is the right place to put this long-term since this
# will not be availabel to other callers of JSON template rendering but
# will not be availabel to other callers of JSON template rendering but
# lets see if it fixes things for now...
if registry is not None:
template_namespace = registry + '/' + namespace
Expand Down
3 changes: 1 addition & 2 deletions tapis_cli/commands/taccapis/v2/apps/init/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ def _take_action_init(self, parsed_args):
# From settings
extra_context[
'docker_namespace'] = settings.TAPIS_CLI_REGISTRY_NAMESPACE
extra_context[
'docker_registry'] = settings.TAPIS_CLI_REGISTRY_URL
extra_context['docker_registry'] = settings.TAPIS_CLI_REGISTRY_URL

for k, v in extra_context.items():
self.messages.append(
Expand Down
4 changes: 2 additions & 2 deletions tapis_cli/commands/taccapis/v2/apps/models/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class App(TapisModel):
service_id_type = 'App'

SEARCH_ARGS = [
# WARNING - date search apparently does not work on apps so never make datetime fields searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# WARNING - date search apparently does not work on apps so never make datetime fields searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("id", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, True),
("name", argtype.STRING, Verbosity.RECORD, argmod.STRING_DEFAULTS,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/apps/models/app_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AppHistory(App):
"""Model of a Tapis system history record
"""
SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("_links", argtype.STRING, Verbosity.RECORD, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, False),
("id", argtype.STRING, Verbosity.RECORD, argmod.STRING_DEFAULTS,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/files/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def take_action(self, parsed_args):
file_path,
storage_system,
destination=dest_path,
# includes=parsed_args.include_files,
# includes=parsed_args.include_files,
excludes=parsed_args.exclude_files,
force=parsed_args.overwrite,
sync=parsed_args.sync,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/files/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class File(TapisModel):
payload = dict()

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("_links", argtype.ARRAY, Verbosity.LISTING, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, 'links', False),
("name", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class FileHistory(File):

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("status", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, False),
("created", argtype.DATETIME, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/files/models/file_pem.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class FilePermission(File):

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("_links", argtype.OBJECT, Verbosity.RECORD, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, False),
("username", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class FileStaging(File):

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("_links", argtype.ARRAY, Verbosity.RECORD, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, 'links', False),
("name", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/files/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def take_action(self, parsed_args):
local_file_path,
storage_system,
remote_file_path,
# includes=parsed_args.include_files,
# includes=parsed_args.include_files,
excludes=parsed_args.exclude_files,
force=parsed_args.overwrite,
sync=parsed_args.sync,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/jobs/models/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Job(TapisModel):
service_id_type = 'Job'

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("_links", argtype.ARRAY, Verbosity.LISTING, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, 'links', False),
("accepted", argtype.DATETIME, Verbosity.RECORD,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/jobs/models/job_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class JobHistory(Job):

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("status", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, False),
("created", argtype.DATETIME, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/jobs/models/job_pem.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class JobPermission(Job):

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("_links", argtype.OBJECT, Verbosity.RECORD, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, False),
("username", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/jobs/outputs_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def take_action(self, parsed_args):
identifier,
destination=dest_dir,
excludes=parsed_args.exclude_files,
# includes=parsed_args.include_files,
# includes=parsed_args.include_files,
force=parsed_args.overwrite,
sync=parsed_args.sync,
progress=parsed_args.progress,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/metadata/models/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Metadata(TapisModel):
service_id_type = 'Unique'

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("uuid", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, True),
("schemaId", argtype.STRING, Verbosity.RECORD_VERBOSE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Notification(TapisModel):
service_id_type = 'Notification'

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("_links", argtype.ARRAY, Verbosity.LISTING, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, 'links', False),
("id", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/postits/models/postit.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PostIt(TapisModel):
service_id_type = 'Post-it'

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("postit", argtype.STRING, Verbosity.BRIEF, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, True),
("remainingUses", argtype.INTEGER, Verbosity.BRIEF,
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/profiles/models/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Profile(TapisModel):
service_id_type = 'User'

SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("first_name", argtype.STRING, Verbosity.BRIEF, [argmod.EQUALS],
argmod.DEFAULT, None, None, True),
("last_name", argtype.STRING, Verbosity.BRIEF, [argmod.EQUALS],
Expand Down
13 changes: 8 additions & 5 deletions tapis_cli/commands/taccapis/v2/systems/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ def update_json_creds(self, parsed_args) -> None:
None) == 'SSHKEYS':
# Override SSH keys
if parsed_args.storage_public_key is not None:
pubkey = open(parsed_args.storage_public_key, 'r').read().strip()
pubkey = open(parsed_args.storage_public_key,
'r').read().strip()
json_data['storage']['auth']['publicKey'] = pubkey
if parsed_args.storage_private_key is not None:
privkey = open(parsed_args.storage_private_key, 'r').read().strip()
privkey = open(parsed_args.storage_private_key,
'r').read().strip()
json_data['storage']['auth']['privateKey'] = privkey
elif json_data.get('storage', {}).get('auth',
{}).get('type',
Expand All @@ -112,10 +114,12 @@ def update_json_creds(self, parsed_args) -> None:
None) == 'SSHKEYS':
# Override SSH keys
if parsed_args.login_public_key is not None:
pubkey = open(parsed_args.login_public_key, 'r').read().strip()
pubkey = open(parsed_args.login_public_key,
'r').read().strip()
json_data['login']['auth']['publicKey'] = pubkey
if parsed_args.login_private_key is not None:
privkey = open(parsed_args.login_private_key, 'r').read().strip()
privkey = open(parsed_args.login_private_key,
'r').read().strip()
json_data['login']['auth']['privateKey'] = privkey
elif json_data.get('login', {}).get('auth',
{}).get('type',
Expand All @@ -126,7 +130,6 @@ def update_json_creds(self, parsed_args) -> None:
'password'] = parsed_args.login_password
return None


def take_action(self, parsed_args):
parsed_args = self.preprocess_args(parsed_args)
self.requests_client.setup(API_NAME, SERVICE_VERSION)
Expand Down
2 changes: 1 addition & 1 deletion tapis_cli/commands/taccapis/v2/systems/models/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class System(TapisModel):
ARGS_ORDERED = ['id', 'name', 'type', 'default']
# WARNING - date search apparently does not work on systems so never make datetime fields searchable
SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("_links", argtype.ARRAY, Verbosity.LISTING, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, 'links', False),
("available", argtype.BOOLEAN, Verbosity.LISTING, argmod.BOOL_DEFAULTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SystemHistory(System):
"""Model of a Tapis system history record
"""
SEARCH_ARGS = [
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
# JSON_field, type, verbosity, mods_allowed, default_mod, choices, override_option, searchable
("_links", argtype.OBJECT, Verbosity.RECORD, argmod.STRING_DEFAULTS,
argmod.DEFAULT, None, None, False),
("id", argtype.STRING, Verbosity.RECORD, argmod.STRING_DEFAULTS,
Expand Down

0 comments on commit 13e87be

Please sign in to comment.