nagios-charmers team mailing list archive
-
nagios-charmers team
-
Mailing list archive
-
Message #00246
[Merge] ~aieri/hw-health-charm:fix/repo-info into hw-health-charm:master
Andrea Ieri has proposed merging ~aieri/hw-health-charm:fix/repo-info into hw-health-charm:master.
Requested reviews:
Alvaro Uría (aluria)
For more details, see:
https://code.launchpad.net/~aieri/hw-health-charm/+git/hw-health-charm/+merge/362666
--
Your team Nagios Charm developers is subscribed to branch hw-health-charm:master.
diff --git a/Makefile b/Makefile
index 2eb1188..df85f4c 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,10 @@ unittest:
build:
@echo "Building charm to base directory $(JUJU_REPOSITORY)"
- @git describe --tags > ./src/repo-info
+ @git show -s --format="commit-sha-1: %H%ncommit-short: %h" > ./src/repo-info
+ @echo -n "info-generated: " >> ./src/repo-info
+ @date --utc >> ./src/repo-info
+ @echo "note: This file should exist only in a built or released charm artifact (not in the charm source code tree)." >> ./src/repo-info
@LAYER_PATH=./layers INTERFACE_PATH=./interfaces\
JUJU_REPOSITORY=$(JUJU_REPOSITORY) charm build ./src --force
diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644
index 0000000..f4aa970
--- /dev/null
+++ b/src/.gitignore
@@ -0,0 +1 @@
+repo-info
diff --git a/src/files/cron_mdadm.py b/src/files/cron_mdadm.py
index b29e4e1..e93d2b3 100755
--- a/src/files/cron_mdadm.py
+++ b/src/files/cron_mdadm.py
@@ -39,7 +39,7 @@ def generate_output(msg):
os.rename(TEMP_FILE, OUTPUT_FILE)
return True
except Exception as error:
- print('Unable to generate output file')
+ print('Unable to generate output file:', error)
return False
diff --git a/src/lib/utils/hwdiscovery.py b/src/lib/utils/hwdiscovery.py
index c3a4a59..1827ac6 100644
--- a/src/lib/utils/hwdiscovery.py
+++ b/src/lib/utils/hwdiscovery.py
@@ -55,7 +55,7 @@ def dmidecode(key):
try:
output = subprocess.check_output(['dmidecode', '-s', key])
- except subprocess.CalledProcessError as e:
+ except subprocess.CalledProcessError as e: # noqa
# print('Unable to get "{}" value from DMI table: {}'.format(key, e))
return
# Ignore comments
@@ -74,7 +74,7 @@ def _supports_mdadm():
['/sbin/mdadm', '--detail', '--scan'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- devices_re = re.compile('^ARRAY\s+(\S+) ')
+ devices_re = re.compile(r'^ARRAY\s+(\S+) ')
for line in devices_raw.stdout.readlines():
line = line.decode().strip()
if devices_re.match(line):
@@ -83,7 +83,7 @@ def _supports_mdadm():
# if devices_raw.stderr:
# print('STDERR: {}'.format(devices_raw.stderr
# .readline().decode().strip()))
- except Exception as e:
+ except Exception:
# log error
pass
return False
Follow ups