Standardize Armada code with YAPF

From recently merged document updates in [0] there is a desire to
standardize the Airship project python codebase.  This is the effort
to do so for the Armada project.

[0] https://review.opendev.org/#/c/671291/

Change-Id: I4fe916d6e330618ea3a1fccfa4bdfdfabb9ffcb2
This commit is contained in:
HUGHES, ALEXANDER (ah8742)
2019-07-24 14:27:20 -05:00
committed by Alexander Hughes
parent d404e3c034
commit b787c418e3
77 changed files with 1298 additions and 1182 deletions

View File

@@ -76,8 +76,8 @@ def set_default_for_default_log_levels():
extra_log_level_defaults = ['kubernetes.client.rest=INFO']
log.set_defaults(
default_log_levels=log.get_default_log_levels() +
extra_log_level_defaults, )
default_log_levels=log.get_default_log_levels()
+ extra_log_level_defaults, )
class ChartDeployAwareLogger(logging.Logger):
@@ -93,5 +93,5 @@ class ChartDeployAwareLogger(logging.Logger):
else:
prefix = ''
prefixed = '{}{}'.format(prefix, msg)
return super(ChartDeployAwareLogger, self)._log(
level, prefixed, *args, **kwargs)
return super(ChartDeployAwareLogger,
self)._log(level, prefixed, *args, **kwargs)

View File

@@ -29,7 +29,8 @@ default_options = [
cfg.StrOpt(
'certs',
default=None,
help=utils.fmt("""
help=utils.fmt(
"""
Absolute path to the certificate file to use for chart registries
""")),
cfg.StrOpt(
@@ -39,13 +40,15 @@ Absolute path to the certificate file to use for chart registries
cfg.BoolOpt(
'middleware',
default=True,
help=utils.fmt("""
help=utils.fmt(
"""
Enables or disables Keystone authentication middleware.
""")),
cfg.StrOpt(
'project_domain_name',
default='default',
help=utils.fmt("""
help=utils.fmt(
"""
The Keystone project domain name used for authentication.
""")),
cfg.StrOpt(
@@ -58,7 +61,8 @@ The Keystone project domain name used for authentication.
cfg.StrOpt(
'ssh_key_path',
default='/home/user/.ssh/',
help=utils.fmt("""Optional path to an SSH private key used for
help=utils.fmt(
"""Optional path to an SSH private key used for
authenticating against a Git source repository. The path must be an absolute
path to the private key that includes the name of the key itself.""")),
cfg.StrOpt(
@@ -85,25 +89,29 @@ path to the private key that includes the name of the key itself.""")),
'lock_acquire_timeout',
default=60,
min=0,
help=utils.fmt("""Time in seconds of how long armada will attempt to
help=utils.fmt(
"""Time in seconds of how long armada will attempt to
acquire a lock before an exception is raised""")),
cfg.IntOpt(
'lock_acquire_delay',
default=5,
min=0,
help=utils.fmt("""Time in seconds of how long to wait between attempts
help=utils.fmt(
"""Time in seconds of how long to wait between attempts
to acquire a lock""")),
cfg.IntOpt(
'lock_update_interval',
default=60,
min=0,
help=utils.fmt("""Time in seconds of how often armada will update the
help=utils.fmt(
"""Time in seconds of how often armada will update the
lock while it is continuing to do work""")),
cfg.IntOpt(
'lock_expiration',
default=600,
min=0,
help=utils.fmt("""Time in seconds of how much time needs to pass since
help=utils.fmt(
"""Time in seconds of how much time needs to pass since
the last update of an existing lock before armada forcibly removes it
and tries to acquire its own lock""")),
]
@@ -116,11 +124,10 @@ def register_opts(conf):
def list_opts():
return {
'DEFAULT':
default_options,
'keystone_authtoken':
(ks_loading.get_session_conf_options() +
ks_loading.get_auth_common_conf_options() +
ks_loading.get_auth_plugin_conf_options('password') +
ks_loading.get_auth_plugin_conf_options('v3password'))
'DEFAULT': default_options,
'keystone_authtoken': (
ks_loading.get_session_conf_options()
+ ks_loading.get_auth_common_conf_options()
+ ks_loading.get_auth_plugin_conf_options('password')
+ ks_loading.get_auth_plugin_conf_options('v3password'))
}

View File

@@ -70,8 +70,8 @@ def _import_modules(module_names):
if not hasattr(module, LIST_OPTS_FUNC_NAME):
raise Exception(
"The module '%s' should have a '%s' function which "
"returns the config options." % (full_module_path,
LIST_OPTS_FUNC_NAME))
"returns the config options." %
(full_module_path, LIST_OPTS_FUNC_NAME))
else:
imported_modules.append(module)
return imported_modules