Merge ~rjschwei/cloud-init:tmplExpand into cloud-init:master

Proposed by Robert Schweikert on 2017-09-21
Status: Merged
Merged at revision: 0451a9f60960da56e3af4f97bbcece3d98482f86
Proposed branch: ~rjschwei/cloud-init:tmplExpand
Merge into: cloud-init:master
Diff against target: 86 lines (+29/-1)
4 files modified
cloudinit/util.py (+2/-0)
config/cloud.cfg.tmpl (+15/-1)
systemd/cloud-init-local.service.tmpl (+4/-0)
systemd/cloud-init.service.tmpl (+8/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve on 2017-09-21
cloud-init commiters 2017-09-21 Pending
Review via email: mp+331140@code.launchpad.net

Commit Message

suse: updates to templates to support openSUSE and SLES.

Things done here:
 - identify 'suse' as a variant in util.system_info and
   also tools/render-cloudcfg.
 - update systemd and cloud.cfg templates for suse specific changes.

LP: #1718640

Description of the Change

Integrate SUSE distros for template expansion of systemd and default config.

To post a comment you must log in.
Scott Moser (smoser) wrote :

over all, changes look fine. two questions inline.

Scott Moser (smoser) wrote :

OK, i really would like to have some response to my inline comments.
Additionally, I put together this change:
 http://paste.ubuntu.com/25587466/
that i'd like added.

And I updated the Commit message.

So, if i can get some feedback on
  * 'basic.target' versus 'sysinit.target',
  * dbus.service

then I can pull this into the release.

PASSED: Continuous integration, rev:73acbf4a00741f8b9b4b278120b6119b83d28b03
https://jenkins.ubuntu.com/server/job/cloud-init-ci/347/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/347/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/util.py b/cloudinit/util.py
2index 4c01f44..e1290aa 100644
3--- a/cloudinit/util.py
4+++ b/cloudinit/util.py
5@@ -598,6 +598,8 @@ def system_info():
6 var = 'ubuntu'
7 elif linux_dist == 'redhat':
8 var = 'rhel'
9+ elif linux_dist == 'suse':
10+ var = 'suse'
11 else:
12 var = 'linux'
13 elif system in ('windows', 'darwin', "freebsd"):
14diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
15index a537d65..e6b20ef 100644
16--- a/config/cloud.cfg.tmpl
17+++ b/config/cloud.cfg.tmpl
18@@ -127,7 +127,7 @@ cloud_final_modules:
19 # (not accessible to handlers/transforms)
20 system_info:
21 # This will affect which distro class gets used
22-{% if variant in ["centos", "debian", "fedora", "rhel", "ubuntu", "freebsd"] %}
23+{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd"] %}
24 distro: {{ variant }}
25 {% else %}
26 # Unknown/fallback distro.
27@@ -186,4 +186,18 @@ system_info:
28 groups: [wheel]
29 sudo: ["ALL=(ALL) NOPASSWD:ALL"]
30 shell: /bin/tcsh
31+{% elif variant in ["suse"] %}
32+ # Default user name + that default users groups (if added/used)
33+ default_user:
34+ name: {{ variant }}
35+ lock_passwd: True
36+ gecos: {{ variant }} Cloud User
37+ groups: [cdrom, users]
38+ sudo: ["ALL=(ALL) NOPASSWD:ALL"]
39+ shell: /bin/bash
40+ # Other config here will be given to the distro class and/or path classes
41+ paths:
42+ cloud_dir: /var/lib/cloud/
43+ templates_dir: /etc/cloud/templates/
44+ ssh_svcname: sshd
45 {% endif %}
46diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl
47index ff9c644..870ccf1 100644
48--- a/systemd/cloud-init-local.service.tmpl
49+++ b/systemd/cloud-init-local.service.tmpl
50@@ -13,6 +13,10 @@ Before=shutdown.target
51 Before=sysinit.target
52 Conflicts=shutdown.target
53 {% endif %}
54+{% if variant in ["suse"] %}
55+Before=basic.target
56+Conflicts=shutdown.target
57+{% endif %}
58 RequiresMountsFor=/var/lib/cloud
59
60 [Service]
61diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
62index 2c71889..0dd45e5 100644
63--- a/systemd/cloud-init.service.tmpl
64+++ b/systemd/cloud-init.service.tmpl
65@@ -13,6 +13,11 @@ After=networking.service
66 {% if variant in ["centos", "fedora", "redhat"] %}
67 After=network.service
68 {% endif %}
69+{% if variant in ["suse"] %}
70+Requires=wicked.service
71+After=wicked.service
72+After=dbus.service
73+{% endif %}
74 Before=network-online.target
75 Before=sshd-keygen.service
76 Before=sshd.service
77@@ -20,6 +25,9 @@ Before=sshd.service
78 Before=sysinit.target
79 Conflicts=shutdown.target
80 {% endif %}
81+{% if variant in ["suse"] %}
82+Conflicts=shutdown.target
83+{% endif %}
84 Before=systemd-user-sessions.service
85
86 [Service]

Subscribers

People subscribed via source and target branches