Skip to content

Commit

Permalink
modified Config class to allow user to add custom options
Browse files Browse the repository at this point in the history
  • Loading branch information
einarnn committed Jan 12, 2024
1 parent 7909526 commit 7349af3
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 55 deletions.
16 changes: 14 additions & 2 deletions bin/system-query-all
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,19 @@ def query(config, secret, url, payload):

if __name__ == '__main__':
config = Config()


# custom local options set to require at least one of the options
g = config.parser.add_mutually_exclusive_group(required=True)
g.add_argument(
'--get-system-health', action='store_true',
help='Get all system health objects')
g.add_argument(
'--get-system-performance', action='store_true',
help='Get all system performance objects')

# as we've added custom arguments, trigger parsing explicitly
config.parse_args()

#
# verbose logging if configured
#
Expand Down Expand Up @@ -56,7 +68,7 @@ if __name__ == '__main__':
node_name = service['nodeName']

# health or performance?
if config.get_system_performance:
if config.config.get_system_performance:
url = service['properties']['restBaseUrl'] + '/getPerformances'
else:
url = service['properties']['restBaseUrl'] + '/getHealths'
Expand Down
Loading

0 comments on commit 7349af3

Please sign in to comment.