Not using new_user.username as it causes exception NoneType

This commit is contained in:
Shay Nehmad 2019-10-03 15:08:55 +03:00
parent 6b315d96c0
commit 129fd7d2de
1 changed files with 3 additions and 3 deletions

View File

@ -47,12 +47,12 @@ class CommunicateAsNewUser(PBA):
def communicate_as_new_user_linux(self, username): def communicate_as_new_user_linux(self, username):
try: try:
with create_auto_new_user(username, PASSWORD, False) as new_user: with create_auto_new_user(username, PASSWORD, False) as _:
commandline = "sudo -u {username} ping -c 1 {domain}".format( commandline = "sudo -u {username} ping -c 1 {domain}".format(
username=new_user.username, username=username,
domain=PING_TEST_DOMAIN) domain=PING_TEST_DOMAIN)
exit_status = os.system(commandline) exit_status = os.system(commandline)
self.send_ping_result_telemetry(exit_status, commandline, new_user.username) self.send_ping_result_telemetry(exit_status, commandline, username)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
PostBreachTelem(self, (e.output, False)).send() PostBreachTelem(self, (e.output, False)).send()