← Back to team overview

nagios-charmers team mailing list archive

[Merge] ~aieri/hw-health-charm:oo-rewrite-cleanup2 into hw-health-charm:oo-rewrite-integration

 

Andrea Ieri has proposed merging ~aieri/hw-health-charm:oo-rewrite-cleanup2 into hw-health-charm:oo-rewrite-integration with ~aieri/hw-health-charm:oo-rewrite-functest as a prerequisite.

Requested reviews:
  Canonical IS Reviewers (canonical-is-reviewers)

For more details, see:
https://code.launchpad.net/~aieri/hw-health-charm/+git/hw-health-charm/+merge/364759

Part 6 of the superseded MR#364694
-- 
Your team Nagios Charm developers is subscribed to branch hw-health-charm:oo-rewrite-integration.
diff --git a/.gitignore b/.gitignore
index 3fbd340..06bf3e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,4 +18,8 @@ __pycache__/
 # version data
 src/repo-info
 
+# build artifacts
+builds
+
+# tools bundle (needed for functional testing)
 tools.zip
diff --git a/src/files/ipmi/check_ipmi_sensor_sudoer b/src/files/ipmi/99-check_ipmi_sensor.sudoer
similarity index 100%
rename from src/files/ipmi/check_ipmi_sensor_sudoer
rename to src/files/ipmi/99-check_ipmi_sensor.sudoer
diff --git a/src/lib/hwhealth/classes.py b/src/lib/hwhealth/classes.py
index 1884059..57226cb 100644
--- a/src/lib/hwhealth/classes.py
+++ b/src/lib/hwhealth/classes.py
@@ -255,7 +255,7 @@ class IpmiTool(Tool):
         super().__init__(shortname='ipmi',
                          nrpe_opts=hookenv.config('ipmi_check_options'))
         self._nrpe_script = 'check_ipmi_sensor'
-        self._sudoer_file = 'check_ipmi_sensor.sudoer'
+        self._sudoer_file = '99-check_ipmi_sensor.sudoer'
 
     def install(self):
         # Install the sudoer file
diff --git a/src/tests/functional/conftest.py b/src/tests/functional/conftest.py
index ea22194..cbc7d9f 100644
--- a/src/tests/functional/conftest.py
+++ b/src/tests/functional/conftest.py
@@ -137,7 +137,15 @@ async def file_stat(run_command):  # pylint: disable=redefined-outer-name
     async def _file_stat(path, target):
         cmd = STAT_CMD % path
         results = await run_command(cmd, target)
-        return json.loads(results['Stdout'])
+        if results['Code'] == '0':
+            return json.loads(results['Stdout'])
+        else:
+            # A common possible error is simply ENOENT, the file ain't there.
+            # A better solution would be to retrieve the exception that the
+            # remote python code raised, but that would probably require a real
+            # RPC setup
+            raise RuntimeError('Stat failed: {}'.format(results))
+
     return _file_stat
 
 

Follow ups