Default --configdir to current working dir
This commit is contained in:
Родитель
796a5e33b4
Коммит
9a6f44a2d1
|
@ -42,6 +42,8 @@ guide for more information.
|
||||||
`SHIPYARD_FS_JSON` have been renamed to `SHIPYARD_CREDENTIALS_CONF`,
|
`SHIPYARD_FS_JSON` have been renamed to `SHIPYARD_CREDENTIALS_CONF`,
|
||||||
`SHIPYARD_CONFIG_CONF`, `SHIPYARD_POOL_CONF`, `SHIPYARD_JOBS_CONF`, and
|
`SHIPYARD_CONFIG_CONF`, `SHIPYARD_POOL_CONF`, `SHIPYARD_JOBS_CONF`, and
|
||||||
`SHIPYARD_FS_CONF` respectively.
|
`SHIPYARD_FS_CONF` respectively.
|
||||||
|
- `--configdir` or `SHIPYARD_CONFIGDIR` now defaults to the current working
|
||||||
|
directory (i.e., `.`) if no other conf file options are specified.
|
||||||
- `aad` can be specified at a "global" level in the credentials configuration
|
- `aad` can be specified at a "global" level in the credentials configuration
|
||||||
file, which is then applied to `batch`, `keyvault` and/or `management`
|
file, which is then applied to `batch`, `keyvault` and/or `management`
|
||||||
section. Please see the credentials configuration guide for more information.
|
section. Please see the credentials configuration guide for more information.
|
||||||
|
|
|
@ -81,7 +81,8 @@ These options must be specified after the command and sub-command. These are:
|
||||||
as the regular switch option, e.g.,
|
as the regular switch option, e.g.,
|
||||||
pool.yaml for --pool. Individually specified
|
pool.yaml for --pool. Individually specified
|
||||||
config options take precedence over this
|
config options take precedence over this
|
||||||
option.
|
option. This defaults to "." if no other
|
||||||
|
configuration option is specified.
|
||||||
--credentials TEXT Credentials config file
|
--credentials TEXT Credentials config file
|
||||||
--config TEXT Global config file
|
--config TEXT Global config file
|
||||||
--fs TEXT RemoteFS config file
|
--fs TEXT RemoteFS config file
|
||||||
|
@ -112,7 +113,9 @@ below if all configuration files are in one directory and named after
|
||||||
their switch. For example, if you have a directory named `config` and under
|
their switch. For example, if you have a directory named `config` and under
|
||||||
that directory you have the files `credentials.yaml`, `config.yaml`,
|
that directory you have the files `credentials.yaml`, `config.yaml`,
|
||||||
`pool.yaml` and `jobs.yaml`, then you can use this argument instead of the
|
`pool.yaml` and `jobs.yaml`, then you can use this argument instead of the
|
||||||
following:
|
following individual conf options. If this parameter is not specified or
|
||||||
|
any of the individual conf options, then this paramter defaults to the
|
||||||
|
current working directory (i.e., `.`).
|
||||||
* `--credentials path/to/credentials.yaml` is required for all actions
|
* `--credentials path/to/credentials.yaml` is required for all actions
|
||||||
except for a select few `keyvault` commands.
|
except for a select few `keyvault` commands.
|
||||||
* `--config path/to/config.yaml` is required for all actions.
|
* `--config path/to/config.yaml` is required for all actions.
|
||||||
|
|
12
shipyard.py
12
shipyard.py
|
@ -214,14 +214,15 @@ class CliContext(object):
|
||||||
:return: new configuration file path
|
:return: new configuration file path
|
||||||
"""
|
"""
|
||||||
# use configdir if available
|
# use configdir if available
|
||||||
if self.configdir is not None and conf_var is None:
|
if conf_var is None:
|
||||||
path = pathlib.Path(self.configdir, '{}.yaml'.format(prefix))
|
cd = self.configdir or '.'
|
||||||
|
path = pathlib.Path(cd, '{}.yaml'.format(prefix))
|
||||||
if path.exists():
|
if path.exists():
|
||||||
return path
|
return path
|
||||||
path = pathlib.Path(self.configdir, '{}.yml'.format(prefix))
|
path = pathlib.Path(cd, '{}.yml'.format(prefix))
|
||||||
if path.exists():
|
if path.exists():
|
||||||
return path
|
return path
|
||||||
return pathlib.Path(self.configdir, '{}.json'.format(prefix))
|
return pathlib.Path(cd, '{}.json'.format(prefix))
|
||||||
else:
|
else:
|
||||||
return conf_var
|
return conf_var
|
||||||
|
|
||||||
|
@ -556,7 +557,8 @@ def _configdir_option(f):
|
||||||
help='Configuration directory where all configuration files can be '
|
help='Configuration directory where all configuration files can be '
|
||||||
'found. Each config file must be named exactly the same as the '
|
'found. Each config file must be named exactly the same as the '
|
||||||
'regular switch option, e.g., pool.yaml for --pool. Individually '
|
'regular switch option, e.g., pool.yaml for --pool. Individually '
|
||||||
'specified config options take precedence over this option.',
|
'specified config options take precedence over this option. This '
|
||||||
|
'defaults to "." if no other configuration option is specified.',
|
||||||
callback=callback)(f)
|
callback=callback)(f)
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче