Skip to content

Commit

Permalink
Add support for Arch Linux in render-cloudcfg
Browse files Browse the repository at this point in the history
 - 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
  • Loading branch information
bitfehler authored and Server Team CI Bot committed Oct 1, 2019
1 parent 067516d commit 5d5a32e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cloudinit/util.py
Expand Up @@ -656,7 +656,8 @@ def system_info():
var = 'unknown'
if system == "linux":
linux_dist = info['dist'][0].lower()
if linux_dist in ('centos', 'debian', 'fedora', 'rhel', 'suse'):
if linux_dist in (
'arch', 'centos', 'debian', 'fedora', 'rhel', 'suse'):
var = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
var = 'ubuntu'
Expand Down
6 changes: 4 additions & 2 deletions config/cloud.cfg.tmpl
Expand Up @@ -137,7 +137,7 @@ cloud_final_modules:
# (not accessible to handlers/transforms)
system_info:
# This will affect which distro class gets used
{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd"] %}
{% if variant in ["arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse", "ubuntu"] %}
distro: {{ variant }}
{% else %}
# Unknown/fallback distro.
Expand Down Expand Up @@ -185,14 +185,16 @@ system_info:
primary: http://ports.ubuntu.com/ubuntu-ports
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
{% elif variant in ["centos", "rhel", "fedora", "suse"] %}
{% elif variant in ["arch", "centos", "fedora", "rhel", "suse"] %}
# Default user name + that default users groups (if added/used)
default_user:
name: {{ variant }}
lock_passwd: True
gecos: {{ variant }} Cloud User
{% if variant == "suse" %}
groups: [cdrom, users]
{% elif variant == "arch" %}
groups: [wheel, users]
{% else %}
groups: [wheel, adm, systemd-journal]
{% endif %}
Expand Down
3 changes: 2 additions & 1 deletion tools/render-cloudcfg
Expand Up @@ -4,7 +4,8 @@ import argparse
import os
import sys

VARIANTS = ["freebsd", "centos", "fedora", "rhel", "suse", "ubuntu", "unknown"]
VARIANTS = ["arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse",
"ubuntu", "unknown"]

if "avoid-pep8-E402-import-not-top-of-file":
_tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
Expand Down

0 comments on commit 5d5a32e

Please sign in to comment.