fix subtask
This commit is contained in:
@@ -18,6 +18,7 @@ class CurrentClients:
|
||||
for username in self.active_clients_list:
|
||||
if username.endswith("_ase"):
|
||||
self.start_client(username, args)
|
||||
logging.info(f"Init start client for {username}")
|
||||
|
||||
def list(self):
|
||||
return self.active_clients_list
|
||||
@@ -35,7 +36,7 @@ class CurrentClients:
|
||||
|
||||
def start_client(self, client, args):
|
||||
process = subprocess.Popen(
|
||||
[f'{self.venv_path}/bin/python3', args.ase_receiver, f'-c {client}'],
|
||||
[f'{self.venv_path}/bin/python3', args.ase_receiver, f'--client={client}'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True
|
||||
@@ -98,7 +99,7 @@ def main():
|
||||
parser.add_argument('-H', '--host', default="mqtt")
|
||||
parser.add_argument('-t', '--sub_topic', default="$CONTROL/dynamic-security/v1/response")
|
||||
parser.add_argument('-T', '--pub_topic', default="$CONTROL/dynamic-security/v1")
|
||||
parser.add_argument('-q', '--qos', type=int,default=0)
|
||||
parser.add_argument('-q', '--qos', type=int,default=1)
|
||||
parser.add_argument('-u', '--username', default="admin")
|
||||
parser.add_argument('-w', '--wallet', default="http://localhost:5000/")
|
||||
parser.add_argument('-P', '--port', type=int, default=1883)
|
||||
@@ -118,7 +119,9 @@ def main():
|
||||
userdata = {'args': args, 'cur_clients': cur_clients, 'auth': auth}
|
||||
|
||||
try:
|
||||
subscribe.callback(ctrl_client_mod, hostname=args.host, port=args.port, topics=args.sub_topic, auth=auth, userdata=userdata)
|
||||
subscribe.callback(ctrl_client_mod, hostname=args.host, port=args.port,
|
||||
topics=args.sub_topic,
|
||||
auth=auth, userdata=userdata)
|
||||
except (KeyboardInterrupt, Exception) as e:
|
||||
logging.info("Terminating: ....")
|
||||
|
||||
|
||||
@@ -111,8 +111,9 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
logging.basicConfig(
|
||||
format=" - PID: %(process)d %(levelname)8s: %(message)s ",
|
||||
level=args.log_level
|
||||
format="%(asctime)s - PID: %(process)d %(levelname)8s: %(message)s ",
|
||||
level=args.log_level,
|
||||
filename=f"/var/log/{args.client.removesuffix('_ase')}_receiver.log"
|
||||
)
|
||||
init_db(args)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user