Merge ~bitfehler/cloud-init:bitfehler/cfg-arch into cloud-init:master

Proposed by Conrad Hoffmann
Status: Merged
Approved by: Ryan Harper
Approved revision: 82c00c7c43109decd17f39fdae195a489b2835bb
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~bitfehler/cloud-init:bitfehler/cfg-arch
Merge into: cloud-init:master
Diff against target: 59 lines (+8/-4)
3 files modified
cloudinit/util.py (+2/-1)
config/cloud.cfg.tmpl (+4/-2)
tools/render-cloudcfg (+2/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper Needs Fixing
Review via email: mp+372953@code.launchpad.net

Commit message

Add support for Arch Linux in render-cloudcfg

 - Detect Arch Linux and set variant accordingly in `system_info()`
 - Allow setting render-cloudcfg variant parameter to 'arch'
 - Adjust some basic settings for Arch Linux in the cloud.cfg.tmpl

The template might need some additional Arch-specific tweaks in the
future, but at least for now the generated config works and contains
the most relevant modules.

Also:
- Sort distro variant lists when adding Arch
- Add debian to known variants in render-cloudcfg

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

Thanks for working on this. Some inline comments, only around sorting lists.

review: Needs Fixing
Revision history for this message
Conrad Hoffmann (bitfehler) wrote :

Thanks for the feedback, I updated the commit accordingly.

One note: I realized that the VARIANTS array in render-cloudcfg was actually missing "debian", even though that is a variant properly handled in the template. I figured I'd add it while at it. Let me know if you think this is too sneaky and should rather be it's own commit or something.

Revision history for this message
Ryan Harper (raharper) wrote :

Thanks for the update. Let's move debian as a separate commit please.

82c00c7... by Conrad Hoffmann <email address hidden>

Add debian to known variants in render-cloudcfg

It was already fully supported in the template and via auto-discovery,
it seems to just have been forgotten from list of supported variants
when setting the variant via command line argument.

Revision history for this message
Conrad Hoffmann (bitfehler) wrote :

Done!

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:20f22ff5b22488f45d5ca5c1979fde5a88a46d98
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1189/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Unit & Style Tests

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Conrad Hoffmann (bitfehler) wrote :

Could someone let me know what the issue is? The unit tests all pass on my machine...

Revision history for this message
Ryan Harper (raharper) wrote :

If you can rebase this branch on master, we landed a fix last week to handle a pylint error which will fix the CI error.

Revision history for this message
Conrad Hoffmann (bitfehler) wrote :

Also done.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:20f22ff5b22488f45d5ca5c1979fde5a88a46d98
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1190/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1190//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 6e8e73b..0d338ca 100644
3--- a/cloudinit/util.py
4+++ b/cloudinit/util.py
5@@ -656,7 +656,8 @@ def system_info():
6 var = 'unknown'
7 if system == "linux":
8 linux_dist = info['dist'][0].lower()
9- if linux_dist in ('centos', 'debian', 'fedora', 'rhel', 'suse'):
10+ if linux_dist in (
11+ 'arch', 'centos', 'debian', 'fedora', 'rhel', 'suse'):
12 var = linux_dist
13 elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
14 var = 'ubuntu'
15diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
16index 684c747..87c37ba 100644
17--- a/config/cloud.cfg.tmpl
18+++ b/config/cloud.cfg.tmpl
19@@ -137,7 +137,7 @@ cloud_final_modules:
20 # (not accessible to handlers/transforms)
21 system_info:
22 # This will affect which distro class gets used
23-{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd"] %}
24+{% if variant in ["arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse", "ubuntu"] %}
25 distro: {{ variant }}
26 {% else %}
27 # Unknown/fallback distro.
28@@ -185,7 +185,7 @@ system_info:
29 primary: http://ports.ubuntu.com/ubuntu-ports
30 security: http://ports.ubuntu.com/ubuntu-ports
31 ssh_svcname: ssh
32-{% elif variant in ["centos", "rhel", "fedora", "suse"] %}
33+{% elif variant in ["arch", "centos", "fedora", "rhel", "suse"] %}
34 # Default user name + that default users groups (if added/used)
35 default_user:
36 name: {{ variant }}
37@@ -193,6 +193,8 @@ system_info:
38 gecos: {{ variant }} Cloud User
39 {% if variant == "suse" %}
40 groups: [cdrom, users]
41+{% elif variant == "arch" %}
42+ groups: [wheel, users]
43 {% else %}
44 groups: [wheel, adm, systemd-journal]
45 {% endif %}
46diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
47index 0957c32..a441f4f 100755
48--- a/tools/render-cloudcfg
49+++ b/tools/render-cloudcfg
50@@ -4,7 +4,8 @@ import argparse
51 import os
52 import sys
53
54-VARIANTS = ["freebsd", "centos", "fedora", "rhel", "suse", "ubuntu", "unknown"]
55+VARIANTS = ["arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse",
56+ "ubuntu", "unknown"]
57
58 if "avoid-pep8-E402-import-not-top-of-file":
59 _tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))

Subscribers

People subscribed via source and target branches