Xav Paice has proposed merging ~xavpaice/hw-health-charm:lp1833897 into
hw-health-charm:master.
Commit message:
Fix for lp1833897 handle separate filesystem for /var
Requested reviews:
Canonical IS Reviewers (canonical-is-reviewers)
Nagios Charm developers (nagios-charmers)
Related bugs:
Bug #1833897 in hw-health-charm: "When /var is mounted separately, ipmi
checks fall over"
https://bugs.launchpad.net/hw-health-charm/+bug/1833897
For more details, see:
https://code.launchpad.net/~xavpaice/hw-health-charm/+git/hw-health-charm/+merge/369219
--
Your team Nagios Charm developers is requested to review the proposed merge of
~xavpaice/hw-health-charm:lp1833897 into hw-health-charm:master.
diff --git a/src/files/ipmi/cron_ipmi_sensors.py b/src/files/ipmi/cron_ipmi_sensors.py
index bfa289b..e4d9f45 100644
--- a/src/files/ipmi/cron_ipmi_sensors.py
+++ b/src/files/ipmi/cron_ipmi_sensors.py
@@ -2,6 +2,7 @@
# -*- coding: us-ascii -*-
import os
+import shutil
import subprocess
import sys
@@ -32,12 +33,12 @@ def gather_metrics():
output = subprocess.check_output(cmdline)
with open(TMP_OUTPUT_FILE, 'w') as fd:
fd.write(output.decode(errors='ignore'))
- os.rename(TMP_OUTPUT_FILE, OUTPUT_FILE)
+ shutil.copyfile(TMP_OUTPUT_FILE, OUTPUT_FILE)
except subprocess.CalledProcessError as error:
output = error.stdout.decode(errors='ignore')
with open(TMP_OUTPUT_FILE, 'w') as fd:
fd.write('{}: {}'.format(NAGIOS_ERRORS[error.returncode], output))
- os.rename(TMP_OUTPUT_FILE, OUTPUT_FILE)
+ shutil.copyfile(TMP_OUTPUT_FILE, OUTPUT_FILE)
except PermissionError as error:
with (OUTPUT_FILE, 'w') as fd:
fd.write('UNKNOWN: {}'.format(error))
--
Mailing list: https://launchpad.net/~nagios-charmers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~nagios-charmers
More help : https://help.launchpad.net/ListHelp