This commit is contained in:
James Campbell 2024-06-06 22:44:34 -04:00
parent 20c897d37a
commit 7a4e62a94e
Signed by: james
GPG Key ID: 2287C33A40DC906A

View File

@ -908,13 +908,13 @@ class Agent:
Results are printed to stdout. Results are printed to stdout.
Params: Params:
config_file: (str) The path to the config file args: (argparse.Namespace) Command line arguments
key: (str) The key indicating the requested metric key: (str) The key indicating the requested metric
""" """
@staticmethod @staticmethod
def run(config_file, key): def run(args, key):
# Read the agent config # Read the agent config
config = Config(config_file, read_metrics = False, read_clusters = False) config = Config(args, read_metrics = False, read_clusters = False)
# Connect to the IPC socket # Connect to the IPC socket
ipc = IPC(config, 'agent') ipc = IPC(config, 'agent')
@ -940,18 +940,18 @@ class Server:
The server side of the connector The server side of the connector
Params: Params:
config_file: (str) The path to the config file args: (argparse.Namespace) Command line arguments
Exceptions: Exceptions:
""" """
def __init__(self, config_file): def __init__(self, args):
# Note the path to the config file so it can be reloaded # Note the path to the config file so it can be reloaded
self.config_file = config_file self.config_file = args.config
# Load config # Load config
self.config = Config(config_file) self.config = Config(args)
# Write pid file # Write pid file
# Note: we record the PID file here so it can't be changed with reload # Note: we record the PID file here so it can't be changed with reload
@ -1324,7 +1324,7 @@ def main():
sys.exit("Failed to signal server: {}".format(e)) sys.exit("Failed to signal server: {}".format(e))
else: else:
# Start running in agent mode # Start running in agent mode
Agent.run(args.config, args.key) Agent.run(args, args.key)
if __name__ == '__main__': if __name__ == '__main__':