Skip to content

Commit

Permalink
Add network tests for illumos
Browse files Browse the repository at this point in the history
  • Loading branch information
citrus-it committed Aug 22, 2022
1 parent decd289 commit 8051c02
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cloudinit/distros/illumos.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def manage_service(self, action, service):
cmd = ['svcs', '-H', '-o', 'state', service]
try:
(out, err) = subp.subp(cmd, capture=True)
except ProcessExecutionError:
except subp.ProcessExecutionError:
# Pass back to caller
raise

Expand All @@ -71,7 +71,7 @@ def manage_service(self, action, service):
# Callers do not actually check the exit status unless
# distro.uses_systemd() is True but exit code 3 would mean
# 'not running', so we use that.
raise ProcessExecutionError(
raise subp.ProcessExecutionError(
cmd=cmd, stdout=out, stderr=err, exit_code=3
)

Expand Down Expand Up @@ -285,5 +285,8 @@ def apply_locale(self, locale, out_fn=None):
def set_timezone(self, tz):
self._update_init('TZ', tz)

def chpasswd(self, plist_in: list, hashed: bool):
for name, password in plist_in:
self.set_passwd(name, password, hashed=hashed)

# vim:ts=4:sw=4:et:fdm=marker
3 changes: 3 additions & 0 deletions test/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

zadm set citest cloud-init=http://172.27.10.254/cloudinit/

2 changes: 2 additions & 0 deletions test/cloud-init/meta-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
instance-id: 40d84db8-bf08-48b9-c347-fb436d131bb1
local-hostname: test
2 changes: 2 additions & 0 deletions test/cloud-init/meta-data~
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
instance-id: 40d84db8-bf08-48b9-c347-fb436d131bb1
local-hostname: test
14 changes: 14 additions & 0 deletions test/cloud-init/network-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ethernets:
bob3:
addresses:
- 10.0.0.5/25
gateway4: 10.0.0.127
match:
macaddress: 02:08:20:7c:68:7a
nameservers:
addresses:
- 1.1.1.1
- 9.9.9.9
search: omnios.org
set-name: bob3
version: 2
20 changes: 20 additions & 0 deletions test/cloud-init/user-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#cloud-config
chpasswd:
expire: false
disable_root: false
hostname: test
password: $6$SEeDRaFR$CI8Y/wfMXioIWlrtTLs75iOA4m/./1Vu78d5Plhk6N/T.yctR/s8ojMIjIhyIJB8lwYJAlQXi5GBuh4O0gjY5/
ssh-pwauth: true
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKi3Xy6qla2g7wH5b1t+6nDi99D/Unl9Hqpi7j4acP8s
cinit
users:
- default
- name: root
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKi3Xy6qla2g7wH5b1t+6nDi99D/Unl9Hqpi7j4acP8s
cinit
packages:
- system/cpuid
- [system/pciutils, 3.7.0]
package_reboot_if_required: false
16 changes: 16 additions & 0 deletions test/cloud-init/user-data~
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#cloud-config
chpasswd:
expire: false
disable_root: false
hostname: test
password: $6$SEeDRaFR$CI8Y/wfMXioIWlrtTLs75iOA4m/./1Vu78d5Plhk6N/T.yctR/s8ojMIjIhyIJB8lwYJAlQXi5GBuh4O0gjY5/
ssh-pwauth: true
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKi3Xy6qla2g7wH5b1t+6nDi99D/Unl9Hqpi7j4acP8s
cinit
users:
- default
- name: root
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKi3Xy6qla2g7wH5b1t+6nDi99D/Unl9Hqpi7j4acP8s
cinit
Empty file added test/cloud-init/vendor-data
Empty file.
1 change: 1 addition & 0 deletions test/cloudinit

0 comments on commit 8051c02

Please sign in to comment.