diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index 752ca529..22cbec0a 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -1522,11 +1522,12 @@ class IpmiHandler(object): 'directory {0}, check ownership and permissions'.format( checkdir)) for saved in self.ipmicmd.save_licenses(directory): - try: - pwent = pwd.getpwnam(self.current_user) - os.chown(saved, pwent.pw_uid, pwent.pw_gid) - except KeyError: - pass + if self.current_user: + try: + pwent = pwd.getpwnam(self.current_user) + os.chown(saved, pwent.pw_uid, pwent.pw_gid) + except KeyError: + pass self.output.put(msg.SavedFile(self.node, saved)) def handle_licenses(self): diff --git a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py index 45e68da6..6cd23566 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py @@ -1368,11 +1368,12 @@ class IpmiHandler(object): 'directory {0}, check ownership and permissions'.format( directory)) for saved in self.ipmicmd.save_licenses(directory): - try: - pwent = pwd.getpwnam(self.current_user) - os.chown(saved, pwent.pw_uid, pwent.pw_gid) - except KeyError: - pass + if self.current_user: + try: + pwent = pwd.getpwnam(self.current_user) + os.chown(saved, pwent.pw_uid, pwent.pw_gid) + except KeyError: + pass self.output.put(msg.SavedFile(self.node, saved)) def handle_licenses(self):