diff --git a/monitor.py b/monitor.py index d0c5463..e8b77c2 100644 --- a/monitor.py +++ b/monitor.py @@ -215,7 +215,10 @@ class TicketClient: resp.raise_for_status() data = resp.json() if data.get('success'): - tid = data['ticket_id'] + tid = data.get('ticket_id') + if not tid: + logger.warning(f'Ticket API success but no ticket_id in response: {data}') + return None logger.info(f'Created ticket #{tid}: {title}') return tid if data.get('existing_ticket_id'): @@ -377,7 +380,7 @@ class LinkStatsCollector: f'ssh -o StrictHostKeyChecking=accept-new -o ConnectTimeout=5 ' f'-o BatchMode=yes -o LogLevel=ERROR ' f'-o ServerAliveInterval=10 -o ServerAliveCountMax=2 ' - f'root@{ip} "{shell_cmd}"' + f'root@{ip} {shlex.quote(shell_cmd)}' ) output = self.pulse.run_command(ssh_cmd) if output is None: