Ubuntu Pastebin

Paste from rharper at Tue, 6 Jun 2017 20:40:04 +0000

Download as text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
commit 12c5c4a3b3a44ab17280b8136ae8128044dbf557 (HEAD -> centos-tpl-cloud-cfg)
Author: Ryan Harper <ryan.harper@canonical.com>
Date:   Mon Jun 5 18:37:30 2017 -0500

    centos config and spec updates
    
    - add centos top level variant
    - update rhel family default config from upstreams spec file
    - add make srpm target and render cloud.cfg in-spec

diff --git a/Makefile b/Makefile
index 33aa7f0..0ba6be7 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,14 @@ ifeq ($(distro),)
   distro = redhat
 endif
 
+ifeq ($(boot_type),)
+  boot_type = systemd
+endif
+
+ifeq ($(SKIP_UNCOMITTED_CHANGES_CHECK),)
+    SKIP_CHECK = SKIP_UNCOMITTED_CHANGES_CHECK=$(SKIP_UNCOMITTED_CHANGES_CHECK)
+endif
+
 READ_VERSION=$(shell $(PYVER) $(CWD)/tools/read-version || \
   echo read-version-failed)
 CODE_VERSION=$(shell $(PYVER) -c "from cloudinit import version; print(version.version_string())")
@@ -69,9 +77,6 @@ check_version:
 	    "not equal to code version '$(CODE_VERSION)'"; exit 2; \
 	    else true; fi
 
-config/cloud.cfg:
-	$(PYVER) ./tools/render-ud  config/cloud.cfg.tpl config/cloud.cfg
-
 clean_pyc:
 	@find . -type f -name "*.pyc" -delete
 
@@ -81,8 +86,11 @@ clean: clean_pyc
 yaml:
 	@$(PYVER) $(CWD)/tools/validate-yaml.py $(YAML_FILES)
 
-rpm: config/cloud.cfg
-	./packages/brpm --distro $(distro)
+rpm:
+	$(SKIP_CHECK) ./packages/brpm --distro $(distro) --boot $(boot_type)
+
+srpm:
+	$(SKIP_CHECK) ./packages/brpm --srpm --distro $(distro) --boot $(boot_type)
 
 deb: config/cloud.cfg
 	@which debuild || \
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index f56c0cf..1fd48a7 100755
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -32,7 +32,7 @@ from cloudinit.distros.parsers import hosts
 
 OSFAMILIES = {
     'debian': ['debian', 'ubuntu'],
-    'redhat': ['fedora', 'rhel'],
+    'redhat': ['centos', 'fedora', 'rhel'],
     'gentoo': ['gentoo'],
     'freebsd': ['freebsd'],
     'suse': ['sles'],
diff --git a/cloudinit/distros/centos.py b/cloudinit/distros/centos.py
new file mode 100644
index 0000000..4b803d2
--- /dev/null
+++ b/cloudinit/distros/centos.py
@@ -0,0 +1,12 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
+from cloudinit.distros import rhel
+from cloudinit import log as logging
+
+LOG = logging.getLogger(__name__)
+
+
+class Distro(rhel.Distro):
+    pass
+
+# vi: ts=4 expandtab
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 3cac8a6..b8c3e4e 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -616,7 +616,7 @@ def system_info():
             info['variant'] = 'ubuntu'
         else:
             for prefix, variant in [('redhat', 'rhel'),
-                                    ('centos', 'rhel'),
+                                    ('centos', 'centos'),
                                     ('fedora', 'fedora'),
                                     ('debian', 'debian')]:
                 if linux_dist.startswith(prefix):
diff --git a/config/cloud.cfg.tpl b/config/cloud.cfg.tpl
index 831139b..5f7d6bc 100644
--- a/config/cloud.cfg.tpl
+++ b/config/cloud.cfg.tpl
@@ -21,6 +21,14 @@ disable_root: false
 disable_root: true
 {% endif %}
 
+{% if platform.variant in ["centos", "fedora", "rhel"] %}
+mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
+resize_rootfs_tmp: /dev
+ssh_deletekeys:   0
+ssh_genkeytypes:  ~
+ssh_pwauth:   0
+{% endif %}
+
 # This will cause the set+update hostname module to not operate (if true)
 preserve_hostname: false
 
@@ -128,14 +136,8 @@ cloud_final_modules:
 # (not accessible to handlers/transforms)
 system_info:
    # This will affect which distro class gets used...
-{% if platform.variant in ["ubuntu"] %}
-   distro: ubuntu
-{% elif platform.variant in ["fedora"] %}
-   distro: fedora
-{% elif platform.variant in ["debian"] %}
-   distro: debian
-{% elif platform.variant in ["rhel"] %}
-   distro: rhel
+{% if platform.variant in ["centos", "debian", "fedora", "rhel", "ubuntu"] %}
+   distro: {{ platform.variant }}
 {% elif platform.variant in ["bsd"] %}
    distro: freebsd
 {% else %}
@@ -172,12 +174,12 @@ system_info:
          primary: http://ports.ubuntu.com/ubuntu-ports
          security: http://ports.ubuntu.com/ubuntu-ports
    ssh_svcname: ssh
-{% elif platform.variant in ["rhel", "fedora"] %}
+{% elif platform.variant in ["centos", "rhel", "fedora"] %}
    # Default user name + that default users groups (if added/used)
    default_user:
-     name: fedora
+     name: {{ platform.variant }}
      lock_passwd: True
-     gecos: Fedora Cloud User
+     gecos: {{ platform.variant}} Cloud User
      groups: [wheel, adm, systemd-journal]
      sudo: ["ALL=(ALL) NOPASSWD:ALL"]
      shell: /bin/bash
diff --git a/packages/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in
index fd3cf93..a1f9d5e 100644
--- a/packages/redhat/cloud-init.spec.in
+++ b/packages/redhat/cloud-init.spec.in
@@ -23,6 +23,9 @@ BuildRequires:  python-setuptools
 BuildRequires:  python-cheetah
 
 # System util packages needed
+%ifarch %{?ix86} x86_64 ia64
+Requires:       dmidecode
+%endif
 Requires:       shadow-utils
 Requires:       rsyslog
 Requires:       iproute
@@ -74,6 +77,7 @@ ssh keys and to let the user run various scripts.
 #end for
 
 %build
+%{__python} ./tools/render-ud config/cloud.cfg.tpl config/cloud.cfg
 %{__python} setup.py build
 
 %install
Download as text