Merge ~bladernr/plainbox-provider-checkbox:1892786-add-maas-user-check into plainbox-provider-checkbox:master

Proposed by Jeff Lane 
Status: Merged
Approved by: Jeff Lane 
Approved revision: c114b301c1b06e1512b77564f2cd2c461104e129
Merged at revision: 52a866fe3f743a21b7ca919b547a47f6a4e3202e
Proposed branch: ~bladernr/plainbox-provider-checkbox:1892786-add-maas-user-check
Merge into: plainbox-provider-checkbox:master
Diff against target: 48 lines (+24/-0)
2 files modified
units/miscellanea/jobs.pxu (+22/-0)
units/miscellanea/test-plan.pxu (+2/-0)
Reviewer Review Type Date Requested Status
Jonathan Cave (community) Approve
Review via email: mp+389758@code.launchpad.net

Commit message

Added job to check BMC accounts for the maas user created during enlistment and commissioning. lp:1892786

To post a comment you must log in.
Revision history for this message
Jonathan Cave (jocave) wrote :

Merges to this provider are now tested against shellcheck among other things. To run the tests locally you can use the command `./manage.py test` much like you would run `./manage.py validate`.

There are a couple of failures in this inline command:

test_job_command_units/miscellanea/jobs.pxu:475-496_miscellanea/maas_user_check (plainbox.provider_manager.InlineShellcheckTests) ...
In - line 2:
FOUND="false"
^---^ SC2034: FOUND appears unused. Verify use (or export if used externally).

In - line 7:
 let "CHAN+=1"
 ^----------^ SC2219: Instead of 'let expr', prefer (( expr )) .

For more information:
  https://www.shellcheck.net/wiki/SC2034 -- FOUND appears unused. Verify use ...
  https://www.shellcheck.net/wiki/SC2219 -- Instead of 'let expr', prefer (( ...
FAIL

review: Needs Fixing
Revision history for this message
Jeff Lane  (bladernr) wrote :
Download full text (7.1 KiB)

I've fixed all that, but when I run manage.py I don't get useful
information, I get confusing tracebacks. Note, this job runs just
fine, it's manage.py that's not working here. I've tested it on a
couple different servers to be sure it actually does what I expect it
to.

bladernr@galactica:~/development/plainbox-provider-checkbox$
./manage.py validate
warning: units/audio/manifest.pxu:19: manifest entry
'has_audio_loopback_connector', field 'prompt', field should be marked
as translatable
warning: units/gpio/manifest.pxu:3: manifest entry 'gpio_loopback',
field 'prompt', field should be marked as translatable
warning: units/image/jobs.pxu:6: job
'image/kernel-publisher-canonical', field 'description', field should
be marked as translatable
warning: units/image/jobs.pxu:4: job
'image/kernel-publisher-canonical', field 'summary', field should be
marked as translatable
warning: units/image/jobs.pxu:18: job 'image/kernel-tracking-stable',
field 'description', field should be marked as translatable
warning: units/image/jobs.pxu:16: job 'image/kernel-tracking-stable',
field 'summary', field should be marked as translatable
warning: units/image/jobs.pxu:30: job
'image/gadget-publisher-canonical', field 'description', field should
be marked as translatable
warning: units/image/jobs.pxu:28: job
'image/gadget-publisher-canonical', field 'summary', field should be
marked as translatable
warning: units/image/jobs.pxu:42: job 'image/gadget-tracking-stable',
field 'description', field should be marked as translatable
warning: units/image/jobs.pxu:40: job 'image/gadget-tracking-stable',
field 'summary', field should be marked as translatable
warning: units/image/jobs.pxu:54: job
'image/model-authority-canonical', field 'description', field should
be marked as translatable
warning: units/image/jobs.pxu:52: job
'image/model-authority-canonical', field 'summary', field should be
marked as translatable
warning: units/image/jobs.pxu:66: job 'image/model-brand-canonical',
field 'description', field should be marked as translatable
warning: units/image/jobs.pxu:64: job 'image/model-brand-canonical',
field 'summary', field should be marked as translatable
warning: units/image/test-plan.pxu:4: test plan 'iot-cert-image-full',
field 'name', field should be marked as translatable
warning: units/image/test-plan.pxu:12: test plan
'iot-cert-image-automated', field 'name', field should be marked as
translatable
warning: units/image/test-plan.pxu:18: test plan
'iot-cert-image-manual', field 'name', field should be marked as
translatable
CRITICAL plainbox.crashes: Executable 'manage.py' invoked with
Namespace(command=<plainbox.provider_manager.ValidateCommand object at
0x7f960fd23128>, debug_console=False, debug_interrupt=False,
deprecated=False, log_level=None, new_validation_core=True, pdb=False,
strict=False, trace=[]) has crashed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/plainbox/impl/clitools.py",
line 560, in dispatch_and_catch_exceptions
    return self.dispatch_command(ns)
  File "/usr/lib/python3/dist-packages/plainbox/impl/clitools.py",
line 556, in dispatch_command
    return ns.command.invoked(ns)
  File "/usr/lib/python3/dist-p...

Read more...

Revision history for this message
Jonathan Cave (jocave) wrote :

Checked that both the test and validate args work on my machine now. PMR should be happy. +1, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/units/miscellanea/jobs.pxu b/units/miscellanea/jobs.pxu
2index 45015d2..5d51176 100644
3--- a/units/miscellanea/jobs.pxu
4+++ b/units/miscellanea/jobs.pxu
5@@ -471,3 +471,25 @@ requires: package.name == 'debsums'
6 command: debsums -c
7 _summary: Check the MD5 sums of installed Debian packages
8 _description: Verify installed Debian package files against MD5 checksum lists from /var/lib/dpkg/info/*.md5sums.
9+
10+plugin: shell
11+category_id: com.canonical.plainbox::miscellanea
12+id: miscellanea/maas_user_check
13+requires:
14+ executable.name == 'ipmitool'
15+ cpuinfo.platform != 's390x'
16+estimated_duration: 0.5
17+user: root
18+command:
19+ CHAN=0
20+ while [ $CHAN -le 15 ]; do
21+ if ipmitool user list $CHAN 2>/dev/null |grep -E "maas.*ADMINISTRATOR"; then
22+ break
23+ fi
24+ (( CHAN+=1 ))
25+ done
26+_description:
27+ This will verify that the maas user was successfully created with admin
28+ privileges
29+_summary:
30+ Verify BMC user called 'maas' was successfully created
31diff --git a/units/miscellanea/test-plan.pxu b/units/miscellanea/test-plan.pxu
32index e40dbaf..6c2d582 100644
33--- a/units/miscellanea/test-plan.pxu
34+++ b/units/miscellanea/test-plan.pxu
35@@ -63,6 +63,7 @@ mandatory_include:
36 miscellanea/cpuid
37 miscellanea/get_make_and_model
38 miscellanea/get_maas_version certification-status=blocker
39+ miscellanea/maas_user_check
40 miscellanea/efi_boot_mode certification-status=blocker
41 miscellanea/secure_boot_mode
42 miscellanea/reboot_firmware
43@@ -93,4 +94,5 @@ mandatory_include:
44 miscellanea/ipmi_test certification-status=blocker
45 miscellanea/bmc_info
46 miscellanea/dmitest_server
47+ miscellanea/maas_user_check
48 include:

Subscribers

People subscribed via source and target branches