mirror of
https://github.com/gyptazy/ProxLB.git
synced 2026-04-05 20:31:57 +02:00
2
.changelogs/1.0.4/89_add_version_output.yml
Normal file
2
.changelogs/1.0.4/89_add_version_output.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
added:
|
||||
- Add version output cli arg. [#89]
|
||||
@@ -198,6 +198,7 @@ The following options and parameters are currently supported:
|
||||
| -j | --json | Returns a JSON of the VM movement. | Unset |
|
||||
| -b | --best-node | Returns the best next node for a VM/CT placement (useful for further usage with Terraform/Ansible). | Unset |
|
||||
| -m | --maintenance | Sets node(s) to maintenance mode & moves workloads away. | Unset |
|
||||
| -v | --version | Returns the ProxLB version on stdout. | Unset |
|
||||
|
||||
### Balancing
|
||||
#### General
|
||||
|
||||
10
proxlb
10
proxlb
@@ -209,9 +209,17 @@ def initialize_args():
|
||||
argparser.add_argument('-j', '--json', help='Return a JSON of the VM movement.', action='store_true', required=False)
|
||||
argparser.add_argument('-b', '--best-node', help='Returns the best next node.', action='store_true', required=False)
|
||||
argparser.add_argument('-m', '--maintenance', help='Sets node to maintenance mode & moves workloads away.', type=str, required=False)
|
||||
argparser.add_argument('-v', '--version', help='Returns the current ProxLB version.', action='store_true', required=False)
|
||||
return argparser.parse_args()
|
||||
|
||||
|
||||
def proxlb_output_version():
|
||||
""" Print ProxLB version information on CLI. """
|
||||
print(f'{__appname__} version {__version__}\nRequired config version: >= {__config_version__}')
|
||||
print('ProxLB support: https://github.com/gyptazy/ProxLB\nDeveloper: gyptazy.com')
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def initialize_config_path(app_args):
|
||||
""" Initialize path to ProxLB config file. """
|
||||
info_prefix = 'Info: [config]:'
|
||||
@@ -1495,6 +1503,8 @@ def main():
|
||||
# Initialize PAS.
|
||||
initialize_logger('CRITICAL')
|
||||
app_args = initialize_args()
|
||||
if app_args.version:
|
||||
proxlb_output_version()
|
||||
config_path = initialize_config_path(app_args)
|
||||
pre_validations(config_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user