Alex | ccb72e0 | 2021-01-20 16:38:03 -0600 | [diff] [blame] | 1 | import os |
| 2 | |
| 3 | from cfg_checker.common.settings import pkg_dir |
| 4 | |
| 5 | _env_name = "local" |
| 6 | _config_path = os.path.join(pkg_dir, 'etc', _env_name + '.env') |
| 7 | |
| 8 | |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 9 | def add_global_arguments(parser): |
| 10 | parser.add_argument( |
| 11 | "-d", |
| 12 | "--debug", |
| 13 | action="store_true", default=False, |
| 14 | help="Set CLI logging level to DEBUG" |
| 15 | ) |
| 16 | parser.add_argument( |
Alex | 3374781 | 2021-04-07 10:11:39 -0500 | [diff] [blame] | 17 | "-k", |
| 18 | "--insecure", |
| 19 | action="store_true", default=False, |
| 20 | help="Use insecure way in SSL requests" |
| 21 | ) |
| 22 | parser.add_argument( |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 23 | '-s', |
| 24 | '--sudo', |
| 25 | action='store_true', default=True, |
| 26 | help="Use sudo for getting salt creds" |
| 27 | ) |
| 28 | parser.add_argument( |
Alex | effa068 | 2021-06-04 12:18:33 -0500 | [diff] [blame^] | 29 | '--ssh-direct', |
| 30 | action='store_true', default=False, |
| 31 | help="Force SSH to do direct connection instead of port forwarding" |
| 32 | ) |
| 33 | |
| 34 | parser.add_argument( |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 35 | '--force-no-key', |
| 36 | action='store_true', default=False, |
Alex | effa068 | 2021-06-04 12:18:33 -0500 | [diff] [blame^] | 37 | help="Force SSH to login with no key" |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 38 | ) |
| 39 | parser.add_argument( |
| 40 | '--skip-nodes', |
| 41 | metavar='skip_string', default=None, |
| 42 | help="String with nodes to skip. Only trailing '*' supported!" |
| 43 | " Example: 'cmp*,ctl01'" |
| 44 | ) |
| 45 | parser.add_argument( |
Alex | ccb72e0 | 2021-01-20 16:38:03 -0600 | [diff] [blame] | 46 | '--kube-config', |
| 47 | metavar='kube_config', default="/root/.kube/config", |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 48 | help="Kube config path with certificates and keys. " |
| 49 | "Default: '/root/.kube/config'" |
| 50 | ) |
| 51 | parser.add_argument( |
Alex | ccb72e0 | 2021-01-20 16:38:03 -0600 | [diff] [blame] | 52 | '--force-env-type', |
| 53 | metavar='force_env_type', |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 54 | help="Specify env to use if function supports multiple among detected" |
| 55 | " Example: SALT/KUBE" |
| 56 | ) |
Alex | ccb72e0 | 2021-01-20 16:38:03 -0600 | [diff] [blame] | 57 | parser.add_argument( |
| 58 | '--env-name', |
| 59 | metavar='env_name', default=_env_name, |
| 60 | help="Use of given env name instead of MCP_ENV var" |
| 61 | "Default: {}".format(_env_name) |
| 62 | ) |
| 63 | |
| 64 | parser.add_argument( |
| 65 | '--env-config', |
| 66 | metavar='env_config', default=_config_path, |
| 67 | help="Force use of given env file" |
| 68 | "Default: '{}'".format(_config_path) |
| 69 | ) |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 70 | |
| 71 | parser.add_argument( |
| 72 | '--skip-nodes-file', |
| 73 | metavar='skip_nodes_file', default=None, |
| 74 | help="Filename with nodes to skip. Note: use fqdn node names." |
| 75 | ) |