diff --git a/0001-Add-initial-redhat-setup.patch b/0001-Add-initial-redhat-setup.patch new file mode 100644 index 0000000..1fffab7 --- /dev/null +++ b/0001-Add-initial-redhat-setup.patch @@ -0,0 +1,604 @@ +From 4b84d29211b7b2121afe9045c71ded5381536d8b Mon Sep 17 00:00:00 2001 +From: Eduardo Otubo +Date: Fri, 7 May 2021 13:36:03 +0200 +Subject: Add initial redhat setup + +Merged patches (RHEL-9/21.1): +- 5688a1d0 Removing python-nose and python-tox as dependency +- 237d57f9 Removing mock dependency +- d1c2f496 Removing python-jsonschema dependency +- 0d1cd14c Don't override default network configuration + +Merged patches (21.1): +- 915d30ad Change gating file to correct rhel version +- 311f318d Removing net-tools dependency +- 74731806 Adding man pages to Red Hat spec file +- 758d333d Removing blocking test from yaml configuration file +- c7e7c59c Changing permission of cloud-init-generator to 755 +- 8b85abbb Installing man pages in the correct place with correct permissions +- c6808d8d Fix unit failure of cloud-final.service if NetworkManager was not present. +- 11866ef6 Report full specific version with "cloud-init --version" + +Rebase notes (18.5): +- added bash_completition file +- added cloud-id file + +Merged patches (20.3): +- 01900d0 changing ds-identify patch from /usr/lib to /usr/libexec +- 7f47ca3 Render the generator from template instead of cp + +Merged patches (19.4): +- 4ab5a61 Fix for network configuration not persisting after reboot +- 84cf125 Removing cloud-user from wheel +- 31290ab Adding gating tests for Azure, ESXi and AWS + +Merged patches (18.5): +- 2d6b469 add power-state-change module to cloud_final_modules +- 764159f Adding systemd mount options to wait for cloud-init +- da4d99e Adding disk_setup to rhel/cloud.cfg +- f5c6832 Enable cloud-init by default on vmware + +Conflicts: +cloudinit/config/cc_chef.py: + - Updated header documentation text + - Replacing double quotes by simple quotes + +setup.py: + - Adding missing cmdclass info + +Signed-off-by: Eduardo Otubo + +Changes: +- move redhat to .distro to use new build script structure +- Fixing changelog for RHEL 9 + +Merged patches (21.1): +- 69bd7f71 DataSourceAzure.py: use hostnamectl to set hostname +- 0407867e Remove race condition between cloud-init and NetworkManager + +Signed-off-by: Miroslav Rezanina +--- + .distro/.gitignore | 1 + + .distro/Makefile | 74 +++++ + .distro/Makefile.common | 30 ++ + .distro/cloud-init-tmpfiles.conf | 1 + + .distro/cloud-init.spec.template | 383 ++++++++++++++++++++++++++ + .distro/gating.yaml | 8 + + .distro/rpmbuild/BUILD/.gitignore | 3 + + .distro/rpmbuild/RPMS/.gitignore | 3 + + .distro/rpmbuild/SOURCES/.gitignore | 3 + + .distro/rpmbuild/SPECS/.gitignore | 3 + + .distro/rpmbuild/SRPMS/.gitignore | 3 + + .distro/scripts/frh.py | 27 ++ + .distro/scripts/git-backport-diff | 327 ++++++++++++++++++++++ + .distro/scripts/git-compile-check | 215 +++++++++++++++ + .distro/scripts/process-patches.sh | 88 ++++++ + .distro/scripts/tarball_checksum.sh | 3 + + .gitignore | 1 + + cloudinit/config/cc_chef.py | 67 ++++- + cloudinit/settings.py | 7 +- + cloudinit/sources/DataSourceAzure.py | 2 +- + requirements.txt | 3 - + rhel/README.rhel | 5 + + rhel/cloud-init-tmpfiles.conf | 1 + + rhel/cloud.cfg | 69 +++++ + rhel/systemd/cloud-config.service | 18 ++ + rhel/systemd/cloud-config.target | 11 + + rhel/systemd/cloud-final.service | 24 ++ + rhel/systemd/cloud-init-local.service | 31 +++ + rhel/systemd/cloud-init.service | 26 ++ + rhel/systemd/cloud-init.target | 7 + + setup.py | 23 +- + tools/read-version | 28 +- + 32 files changed, 1441 insertions(+), 54 deletions(-) + create mode 100644 .distro/.gitignore + create mode 100644 .distro/Makefile + create mode 100644 .distro/Makefile.common + create mode 100644 .distro/cloud-init-tmpfiles.conf + create mode 100644 .distro/cloud-init.spec.template + create mode 100644 .distro/gating.yaml + create mode 100644 .distro/rpmbuild/BUILD/.gitignore + create mode 100644 .distro/rpmbuild/RPMS/.gitignore + create mode 100644 .distro/rpmbuild/SOURCES/.gitignore + create mode 100644 .distro/rpmbuild/SPECS/.gitignore + create mode 100644 .distro/rpmbuild/SRPMS/.gitignore + create mode 100755 .distro/scripts/frh.py + create mode 100755 .distro/scripts/git-backport-diff + create mode 100755 .distro/scripts/git-compile-check + create mode 100755 .distro/scripts/process-patches.sh + create mode 100755 .distro/scripts/tarball_checksum.sh + create mode 100644 rhel/README.rhel + create mode 100644 rhel/cloud-init-tmpfiles.conf + create mode 100644 rhel/cloud.cfg + create mode 100644 rhel/systemd/cloud-config.service + create mode 100644 rhel/systemd/cloud-config.target + create mode 100644 rhel/systemd/cloud-final.service + create mode 100644 rhel/systemd/cloud-init-local.service + create mode 100644 rhel/systemd/cloud-init.service + create mode 100644 rhel/systemd/cloud-init.target + +diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py +index aaf71366..97ef649a 100644 +--- a/cloudinit/config/cc_chef.py ++++ b/cloudinit/config/cc_chef.py +@@ -6,7 +6,70 @@ + # + # This file is part of cloud-init. See LICENSE file for license information. + +-"""Chef: module that configures, starts and installs chef.""" ++""" ++Chef ++---- ++**Summary:** module that configures, starts and installs chef. ++ ++This module enables chef to be installed (from packages or ++from gems, or from omnibus). Before this occurs chef configurations are ++written to disk (validation.pem, client.pem, firstboot.json, client.rb), ++and needed chef folders/directories are created (/etc/chef and /var/log/chef ++and so-on). Then once installing proceeds correctly if configured chef will ++be started (in daemon mode or in non-daemon mode) and then once that has ++finished (if ran in non-daemon mode this will be when chef finishes ++converging, if ran in daemon mode then no further actions are possible since ++chef will have forked into its own process) then a post run function can ++run that can do finishing activities (such as removing the validation pem ++file). ++ ++**Internal name:** ``cc_chef`` ++ ++**Module frequency:** per always ++ ++**Supported distros:** all ++ ++**Config keys**:: ++ ++ chef: ++ directories: (defaulting to /etc/chef, /var/log/chef, /var/lib/chef, ++ /var/cache/chef, /var/backups/chef, /run/chef) ++ validation_cert: (optional string to be written to file validation_key) ++ special value 'system' means set use existing file ++ validation_key: (optional the path for validation_cert. default ++ /etc/chef/validation.pem) ++ firstboot_path: (path to write run_list and initial_attributes keys that ++ should also be present in this configuration, defaults ++ to /etc/chef/firstboot.json) ++ exec: boolean to run or not run chef (defaults to false, unless ++ a gem installed is requested ++ where this will then default ++ to true) ++ ++ chef.rb template keys (if falsey, then will be skipped and not ++ written to /etc/chef/client.rb) ++ ++ chef: ++ client_key: ++ encrypted_data_bag_secret: ++ environment: ++ file_backup_path: ++ file_cache_path: ++ json_attribs: ++ log_level: ++ log_location: ++ node_name: ++ omnibus_url: ++ omnibus_url_retries: ++ omnibus_version: ++ pid_file: ++ server_url: ++ show_time: ++ ssl_verify_mode: ++ validation_cert: ++ validation_key: ++ validation_name: ++""" + + import itertools + import json +@@ -31,7 +94,7 @@ CHEF_DIRS = tuple([ + '/var/lib/chef', + '/var/cache/chef', + '/var/backups/chef', +- '/var/run/chef', ++ '/run/chef', + ]) + REQUIRED_CHEF_DIRS = tuple([ + '/etc/chef', +diff --git a/cloudinit/settings.py b/cloudinit/settings.py +index 91e1bfe7..e690c0fd 100644 +--- a/cloudinit/settings.py ++++ b/cloudinit/settings.py +@@ -47,13 +47,16 @@ CFG_BUILTIN = { + ], + 'def_log_file': '/var/log/cloud-init.log', + 'log_cfgs': [], +- 'syslog_fix_perms': ['syslog:adm', 'root:adm', 'root:wheel', 'root:root'], ++ 'mount_default_fields': [None, None, 'auto', 'defaults,nofail', '0', '2'], ++ 'ssh_deletekeys': False, ++ 'ssh_genkeytypes': [], ++ 'syslog_fix_perms': [], + 'system_info': { + 'paths': { + 'cloud_dir': '/var/lib/cloud', + 'templates_dir': '/etc/cloud/templates/', + }, +- 'distro': 'ubuntu', ++ 'distro': 'rhel', + 'network': {'renderers': None}, + }, + 'vendor_data': {'enabled': True, 'prefix': []}, +diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py +index cee630f7..553b5a7e 100755 +--- a/cloudinit/sources/DataSourceAzure.py ++++ b/cloudinit/sources/DataSourceAzure.py +@@ -296,7 +296,7 @@ def get_hostname(hostname_command='hostname'): + + + def set_hostname(hostname, hostname_command='hostname'): +- subp.subp([hostname_command, hostname]) ++ util.subp(['hostnamectl', 'set-hostname', str(hostname)]) + + + @azure_ds_telemetry_reporter +diff --git a/requirements.txt b/requirements.txt +index 5817da3b..5b8becd7 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -29,6 +29,3 @@ requests + + # For patching pieces of cloud-config together + jsonpatch +- +-# For validating cloud-config sections per schema definitions +-jsonschema +diff --git a/rhel/README.rhel b/rhel/README.rhel +new file mode 100644 +index 00000000..aa29630d +--- /dev/null ++++ b/rhel/README.rhel +@@ -0,0 +1,5 @@ ++The following cloud-init modules are currently unsupported on this OS: ++ - apt_update_upgrade ('apt_update', 'apt_upgrade', 'apt_mirror', 'apt_preserve_sources_list', 'apt_old_mirror', 'apt_sources', 'debconf_selections', 'packages' options) ++ - byobu ('byobu_by_default' option) ++ - chef ++ - grub_dpkg +diff --git a/rhel/cloud-init-tmpfiles.conf b/rhel/cloud-init-tmpfiles.conf +new file mode 100644 +index 00000000..0c6d2a3b +--- /dev/null ++++ b/rhel/cloud-init-tmpfiles.conf +@@ -0,0 +1 @@ ++d /run/cloud-init 0700 root root - - +diff --git a/rhel/cloud.cfg b/rhel/cloud.cfg +new file mode 100644 +index 00000000..9ecba215 +--- /dev/null ++++ b/rhel/cloud.cfg +@@ -0,0 +1,69 @@ ++users: ++ - default ++ ++disable_root: 1 ++ssh_pwauth: 0 ++ ++mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2'] ++resize_rootfs_tmp: /dev ++ssh_deletekeys: 1 ++ssh_genkeytypes: ~ ++syslog_fix_perms: ~ ++disable_vmware_customization: false ++ ++cloud_init_modules: ++ - disk_setup ++ - migrator ++ - bootcmd ++ - write-files ++ - growpart ++ - resizefs ++ - set_hostname ++ - update_hostname ++ - update_etc_hosts ++ - rsyslog ++ - users-groups ++ - ssh ++ ++cloud_config_modules: ++ - mounts ++ - locale ++ - set-passwords ++ - rh_subscription ++ - yum-add-repo ++ - package-update-upgrade-install ++ - timezone ++ - puppet ++ - chef ++ - salt-minion ++ - mcollective ++ - disable-ec2-metadata ++ - runcmd ++ ++cloud_final_modules: ++ - rightscale_userdata ++ - scripts-per-once ++ - scripts-per-boot ++ - scripts-per-instance ++ - scripts-user ++ - ssh-authkey-fingerprints ++ - keys-to-console ++ - phone-home ++ - final-message ++ - power-state-change ++ ++system_info: ++ default_user: ++ name: cloud-user ++ lock_passwd: true ++ gecos: Cloud User ++ groups: [adm, systemd-journal] ++ sudo: ["ALL=(ALL) NOPASSWD:ALL"] ++ shell: /bin/bash ++ distro: rhel ++ paths: ++ cloud_dir: /var/lib/cloud ++ templates_dir: /etc/cloud/templates ++ ssh_svcname: sshd ++ ++# vim:syntax=yaml +diff --git a/rhel/systemd/cloud-config.service b/rhel/systemd/cloud-config.service +new file mode 100644 +index 00000000..f3dcd4be +--- /dev/null ++++ b/rhel/systemd/cloud-config.service +@@ -0,0 +1,18 @@ ++[Unit] ++Description=Apply the settings specified in cloud-config ++After=network-online.target cloud-config.target ++Wants=network-online.target cloud-config.target ++ConditionPathExists=!/etc/cloud/cloud-init.disabled ++ConditionKernelCommandLine=!cloud-init=disabled ++ ++[Service] ++Type=oneshot ++ExecStart=/usr/bin/cloud-init modules --mode=config ++RemainAfterExit=yes ++TimeoutSec=0 ++ ++# Output needs to appear in instance console output ++StandardOutput=journal+console ++ ++[Install] ++WantedBy=cloud-init.target +diff --git a/rhel/systemd/cloud-config.target b/rhel/systemd/cloud-config.target +new file mode 100644 +index 00000000..ae9b7d02 +--- /dev/null ++++ b/rhel/systemd/cloud-config.target +@@ -0,0 +1,11 @@ ++# cloud-init normally emits a "cloud-config" upstart event to inform third ++# parties that cloud-config is available, which does us no good when we're ++# using systemd. cloud-config.target serves as this synchronization point ++# instead. Services that would "start on cloud-config" with upstart can ++# instead use "After=cloud-config.target" and "Wants=cloud-config.target" ++# as appropriate. ++ ++[Unit] ++Description=Cloud-config availability ++Wants=cloud-init-local.service cloud-init.service ++After=cloud-init-local.service cloud-init.service +diff --git a/rhel/systemd/cloud-final.service b/rhel/systemd/cloud-final.service +new file mode 100644 +index 00000000..e281c0cf +--- /dev/null ++++ b/rhel/systemd/cloud-final.service +@@ -0,0 +1,24 @@ ++[Unit] ++Description=Execute cloud user/final scripts ++After=network-online.target cloud-config.service rc-local.service ++Wants=network-online.target cloud-config.service ++ConditionPathExists=!/etc/cloud/cloud-init.disabled ++ConditionKernelCommandLine=!cloud-init=disabled ++ ++[Service] ++Type=oneshot ++ExecStart=/usr/bin/cloud-init modules --mode=final ++RemainAfterExit=yes ++TimeoutSec=0 ++KillMode=process ++# Restart NetworkManager if it is present and running. ++ExecStartPost=/bin/sh -c 'u=NetworkManager.service; \ ++ out=$(systemctl show --property=SubState $u) || exit; \ ++ [ "$out" = "SubState=running" ] || exit 0; \ ++ systemctl reload-or-try-restart $u' ++ ++# Output needs to appear in instance console output ++StandardOutput=journal+console ++ ++[Install] ++WantedBy=cloud-init.target +diff --git a/rhel/systemd/cloud-init-local.service b/rhel/systemd/cloud-init-local.service +new file mode 100644 +index 00000000..8f9f6c9f +--- /dev/null ++++ b/rhel/systemd/cloud-init-local.service +@@ -0,0 +1,31 @@ ++[Unit] ++Description=Initial cloud-init job (pre-networking) ++DefaultDependencies=no ++Wants=network-pre.target ++After=systemd-remount-fs.service ++Requires=dbus.socket ++After=dbus.socket ++Before=NetworkManager.service network.service ++Before=network-pre.target ++Before=shutdown.target ++Before=firewalld.target ++Conflicts=shutdown.target ++RequiresMountsFor=/var/lib/cloud ++ConditionPathExists=!/etc/cloud/cloud-init.disabled ++ConditionKernelCommandLine=!cloud-init=disabled ++ ++[Service] ++Type=oneshot ++ExecStartPre=/bin/mkdir -p /run/cloud-init ++ExecStartPre=/sbin/restorecon /run/cloud-init ++ExecStartPre=/usr/bin/touch /run/cloud-init/enabled ++ExecStart=/usr/bin/cloud-init init --local ++ExecStart=/bin/touch /run/cloud-init/network-config-ready ++RemainAfterExit=yes ++TimeoutSec=0 ++ ++# Output needs to appear in instance console output ++StandardOutput=journal+console ++ ++[Install] ++WantedBy=cloud-init.target +diff --git a/rhel/systemd/cloud-init.service b/rhel/systemd/cloud-init.service +new file mode 100644 +index 00000000..0b3d796d +--- /dev/null ++++ b/rhel/systemd/cloud-init.service +@@ -0,0 +1,26 @@ ++[Unit] ++Description=Initial cloud-init job (metadata service crawler) ++Wants=cloud-init-local.service ++Wants=sshd-keygen.service ++Wants=sshd.service ++After=cloud-init-local.service ++After=NetworkManager.service network.service ++After=NetworkManager-wait-online.service ++Before=network-online.target ++Before=sshd-keygen.service ++Before=sshd.service ++Before=systemd-user-sessions.service ++ConditionPathExists=!/etc/cloud/cloud-init.disabled ++ConditionKernelCommandLine=!cloud-init=disabled ++ ++[Service] ++Type=oneshot ++ExecStart=/usr/bin/cloud-init init ++RemainAfterExit=yes ++TimeoutSec=0 ++ ++# Output needs to appear in instance console output ++StandardOutput=journal+console ++ ++[Install] ++WantedBy=cloud-init.target +diff --git a/rhel/systemd/cloud-init.target b/rhel/systemd/cloud-init.target +new file mode 100644 +index 00000000..083c3b6f +--- /dev/null ++++ b/rhel/systemd/cloud-init.target +@@ -0,0 +1,7 @@ ++# cloud-init target is enabled by cloud-init-generator ++# To disable it you can either: ++# a.) boot with kernel cmdline of 'cloud-init=disabled' ++# b.) touch a file /etc/cloud/cloud-init.disabled ++[Unit] ++Description=Cloud-init target ++After=multi-user.target +diff --git a/setup.py b/setup.py +index cbacf48e..d5cd01a4 100755 +--- a/setup.py ++++ b/setup.py +@@ -125,14 +125,6 @@ INITSYS_FILES = { + 'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)], + 'sysvinit_openrc': [f for f in glob('sysvinit/gentoo/*') if is_f(f)], + 'sysvinit_suse': [f for f in glob('sysvinit/suse/*') if is_f(f)], +- 'systemd': [render_tmpl(f) +- for f in (glob('systemd/*.tmpl') + +- glob('systemd/*.service') + +- glob('systemd/*.target')) +- if (is_f(f) and not is_generator(f))], +- 'systemd.generators': [ +- render_tmpl(f, mode=0o755) +- for f in glob('systemd/*') if is_f(f) and is_generator(f)], + 'upstart': [f for f in glob('upstart/*') if is_f(f)], + } + INITSYS_ROOTS = { +@@ -142,9 +134,6 @@ INITSYS_ROOTS = { + 'sysvinit_deb': 'etc/init.d', + 'sysvinit_openrc': 'etc/init.d', + 'sysvinit_suse': 'etc/init.d', +- 'systemd': pkg_config_read('systemd', 'systemdsystemunitdir'), +- 'systemd.generators': pkg_config_read('systemd', +- 'systemdsystemgeneratordir'), + 'upstart': 'etc/init/', + } + INITSYS_TYPES = sorted([f.partition(".")[0] for f in INITSYS_ROOTS.keys()]) +@@ -245,14 +234,11 @@ if not in_virtualenv(): + INITSYS_ROOTS[k] = "/" + INITSYS_ROOTS[k] + + data_files = [ +- (ETC + '/cloud', [render_tmpl("config/cloud.cfg.tmpl")]), ++ (ETC + '/bash_completion.d', ['bash_completion/cloud-init']), + (ETC + '/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')), + (ETC + '/cloud/templates', glob('templates/*')), +- (USR_LIB_EXEC + '/cloud-init', ['tools/ds-identify', +- 'tools/uncloud-init', ++ (USR_LIB_EXEC + '/cloud-init', ['tools/uncloud-init', + 'tools/write-ssh-key-fingerprints']), +- (USR + '/share/bash-completion/completions', +- ['bash_completion/cloud-init']), + (USR + '/share/doc/cloud-init', [f for f in glob('doc/*') if is_f(f)]), + (USR + '/share/doc/cloud-init/examples', + [f for f in glob('doc/examples/*') if is_f(f)]), +@@ -263,8 +249,7 @@ if not platform.system().endswith('BSD'): + data_files.extend([ + (ETC + '/NetworkManager/dispatcher.d/', + ['tools/hook-network-manager']), +- (ETC + '/dhcp/dhclient-exit-hooks.d/', ['tools/hook-dhclient']), +- (LIB + '/udev/rules.d', [f for f in glob('udev/*.rules')]) ++ ('/usr/lib/udev/rules.d', [f for f in glob('udev/*.rules')]) + ]) + # Use a subclass for install that handles + # adding on the right init system configuration files +@@ -286,8 +271,6 @@ setuptools.setup( + scripts=['tools/cloud-init-per'], + license='Dual-licensed under GPLv3 or Apache 2.0', + data_files=data_files, +- install_requires=requirements, +- cmdclass=cmdclass, + entry_points={ + 'console_scripts': [ + 'cloud-init = cloudinit.cmd.main:main', +diff --git a/tools/read-version b/tools/read-version +index 02c90643..79755f78 100755 +--- a/tools/read-version ++++ b/tools/read-version +@@ -71,32 +71,8 @@ version_long = None + is_release_branch_ci = ( + os.environ.get("TRAVIS_PULL_REQUEST_BRANCH", "").startswith("upstream/") + ) +-if is_gitdir(_tdir) and which("git") and not is_release_branch_ci: +- flags = [] +- if use_tags: +- flags = ['--tags'] +- cmd = ['git', 'describe', '--abbrev=8', '--match=[0-9]*'] + flags +- +- try: +- version = tiny_p(cmd).strip() +- except RuntimeError: +- version = None +- +- if version is None or not version.startswith(src_version): +- sys.stderr.write("git describe version (%s) differs from " +- "cloudinit.version (%s)\n" % (version, src_version)) +- sys.stderr.write( +- "Please get the latest upstream tags.\n" +- "As an example, this can be done with the following:\n" +- "$ git remote add upstream https://git.launchpad.net/cloud-init\n" +- "$ git fetch upstream --tags\n" +- ) +- sys.exit(1) +- +- version_long = tiny_p(cmd + ["--long"]).strip() +-else: +- version = src_version +- version_long = None ++version = src_version ++version_long = None + + # version is X.Y.Z[+xxx.gHASH] + # version_long is None or X.Y.Z-xxx-gHASH +-- +2.27.0 + diff --git a/0002-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch b/0002-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch new file mode 100644 index 0000000..4939291 --- /dev/null +++ b/0002-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch @@ -0,0 +1,283 @@ +From 3f895d7236fab4f12482435829b530022a2205ec Mon Sep 17 00:00:00 2001 +From: Eduardo Otubo +Date: Fri, 7 May 2021 13:36:06 +0200 +Subject: Do not write NM_CONTROLLED=no in generated interface config files + +Conflicts 20.3: + - Not appplying patch on cloudinit/net/sysconfig.py since it now has a +mechanism to identify if cloud-init is running on RHEL, having the +correct settings for NM_CONTROLLED. + +Merged patches (21.1): +- ecbace48 sysconfig: Don't write BOOTPROTO=dhcp for ipv6 dhcp +- a1a00383 include 'NOZEROCONF=yes' in /etc/sysconfig/network +X-downstream-only: true +Signed-off-by: Eduardo Otubo +Signed-off-by: Ryan McCabe +--- + cloudinit/net/sysconfig.py | 13 +++++++++++-- + tests/unittests/test_net.py | 28 ---------------------------- + 2 files changed, 11 insertions(+), 30 deletions(-) + +diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py +index 99a4bae4..d5440998 100644 +--- a/cloudinit/net/sysconfig.py ++++ b/cloudinit/net/sysconfig.py +@@ -289,7 +289,7 @@ class Renderer(renderer.Renderer): + # details about this) + + iface_defaults = { +- 'rhel': {'ONBOOT': True, 'USERCTL': False, 'NM_CONTROLLED': False, ++ 'rhel': {'ONBOOT': True, 'USERCTL': False, + 'BOOTPROTO': 'none'}, + 'suse': {'BOOTPROTO': 'static', 'STARTMODE': 'auto'}, + } +@@ -925,7 +925,16 @@ class Renderer(renderer.Renderer): + # Distros configuring /etc/sysconfig/network as a file e.g. Centos + if sysconfig_path.endswith('network'): + util.ensure_dir(os.path.dirname(sysconfig_path)) +- netcfg = [_make_header(), 'NETWORKING=yes'] ++ netcfg = [] ++ for line in util.load_file(sysconfig_path, quiet=True).split('\n'): ++ if 'cloud-init' in line: ++ break ++ if not line.startswith(('NETWORKING=', ++ 'IPV6_AUTOCONF=', ++ 'NETWORKING_IPV6=')): ++ netcfg.append(line) ++ # Now generate the cloud-init portion of sysconfig/network ++ netcfg.extend([_make_header(), 'NETWORKING=yes']) + if network_state.use_ipv6: + netcfg.append('NETWORKING_IPV6=yes') + netcfg.append('IPV6_AUTOCONF=no') +diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py +index 38d934d4..c67b5fcc 100644 +--- a/tests/unittests/test_net.py ++++ b/tests/unittests/test_net.py +@@ -535,7 +535,6 @@ GATEWAY=172.19.3.254 + HWADDR=fa:16:3e:ed:9a:59 + IPADDR=172.19.1.34 + NETMASK=255.255.252.0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -633,7 +632,6 @@ IPADDR=172.19.1.34 + IPADDR1=10.0.0.10 + NETMASK=255.255.252.0 + NETMASK1=255.255.255.0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -756,7 +754,6 @@ IPV6_AUTOCONF=no + IPV6_DEFAULTGW=2001:DB8::1 + IPV6_FORCE_ACCEPT_RA=no + NETMASK=255.255.252.0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -884,7 +881,6 @@ NETWORK_CONFIGS = { + BOOTPROTO=none + DEVICE=eth1 + HWADDR=cf:d6:af:48:e8:80 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no"""), +@@ -901,7 +897,6 @@ NETWORK_CONFIGS = { + IPADDR=192.168.21.3 + NETMASK=255.255.255.0 + METRIC=10000 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no"""), +@@ -1032,7 +1027,6 @@ NETWORK_CONFIGS = { + IPV6_AUTOCONF=no + IPV6_FORCE_ACCEPT_RA=no + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -1737,7 +1731,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + DHCPV6C=yes + IPV6INIT=yes + MACADDR=aa:bb:cc:dd:ee:ff +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Bond + USERCTL=no"""), +@@ -1745,7 +1738,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + BOOTPROTO=dhcp + DEVICE=bond0.200 + DHCLIENT_SET_DEFAULT_ROUTE=no +- NM_CONTROLLED=no + ONBOOT=yes + PHYSDEV=bond0 + USERCTL=no +@@ -1763,7 +1755,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + IPV6_DEFAULTGW=2001:4800:78ff:1b::1 + MACADDR=bb:bb:bb:bb:bb:aa + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + PRIO=22 + STP=no +@@ -1773,7 +1764,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + BOOTPROTO=none + DEVICE=eth0 + HWADDR=c0:d6:9f:2c:e8:80 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no"""), +@@ -1790,7 +1780,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + MTU=1500 + NETMASK=255.255.255.0 + NETMASK1=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + PHYSDEV=eth0 + USERCTL=no +@@ -1800,7 +1789,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + DEVICE=eth1 + HWADDR=aa:d6:9f:2c:e8:80 + MASTER=bond0 +- NM_CONTROLLED=no + ONBOOT=yes + SLAVE=yes + TYPE=Ethernet +@@ -1810,7 +1798,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + DEVICE=eth2 + HWADDR=c0:bb:9f:2c:e8:80 + MASTER=bond0 +- NM_CONTROLLED=no + ONBOOT=yes + SLAVE=yes + TYPE=Ethernet +@@ -1820,7 +1807,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + BRIDGE=br0 + DEVICE=eth3 + HWADDR=66:bb:9f:2c:e8:80 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no"""), +@@ -1829,7 +1815,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + BRIDGE=br0 + DEVICE=eth4 + HWADDR=98:bb:9f:2c:e8:80 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no"""), +@@ -1838,7 +1823,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true + DEVICE=eth5 + DHCLIENT_SET_DEFAULT_ROUTE=no + HWADDR=98:bb:9f:2c:e8:8a +- NM_CONTROLLED=no + ONBOOT=no + TYPE=Ethernet + USERCTL=no"""), +@@ -2294,7 +2278,6 @@ iface bond0 inet6 static + MTU=9000 + NETMASK=255.255.255.0 + NETMASK1=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Bond + USERCTL=no +@@ -2304,7 +2287,6 @@ iface bond0 inet6 static + DEVICE=bond0s0 + HWADDR=aa:bb:cc:dd:e8:00 + MASTER=bond0 +- NM_CONTROLLED=no + ONBOOT=yes + SLAVE=yes + TYPE=Ethernet +@@ -2326,7 +2308,6 @@ iface bond0 inet6 static + DEVICE=bond0s1 + HWADDR=aa:bb:cc:dd:e8:01 + MASTER=bond0 +- NM_CONTROLLED=no + ONBOOT=yes + SLAVE=yes + TYPE=Ethernet +@@ -2383,7 +2364,6 @@ iface bond0 inet6 static + BOOTPROTO=none + DEVICE=en0 + HWADDR=aa:bb:cc:dd:e8:00 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no"""), +@@ -2402,7 +2382,6 @@ iface bond0 inet6 static + MTU=2222 + NETMASK=255.255.255.0 + NETMASK1=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + PHYSDEV=en0 + USERCTL=no +@@ -2467,7 +2446,6 @@ iface bond0 inet6 static + DEVICE=br0 + IPADDR=192.168.2.2 + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=yes + PRIO=22 + STP=no +@@ -2591,7 +2569,6 @@ iface bond0 inet6 static + HWADDR=52:54:00:12:34:00 + IPADDR=192.168.1.2 + NETMASK=255.255.255.0 +- NM_CONTROLLED=no + ONBOOT=no + TYPE=Ethernet + USERCTL=no +@@ -2601,7 +2578,6 @@ iface bond0 inet6 static + DEVICE=eth1 + HWADDR=52:54:00:12:34:aa + MTU=1480 +- NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -2610,7 +2586,6 @@ iface bond0 inet6 static + BOOTPROTO=none + DEVICE=eth2 + HWADDR=52:54:00:12:34:ff +- NM_CONTROLLED=no + ONBOOT=no + TYPE=Ethernet + USERCTL=no +@@ -3027,7 +3002,6 @@ class TestRhelSysConfigRendering(CiTestCase): + BOOTPROTO=dhcp + DEVICE=eth1000 + HWADDR=07-1c-c6-75-a4-be +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -3148,7 +3122,6 @@ GATEWAY=10.0.2.2 + HWADDR=52:54:00:12:34:00 + IPADDR=10.0.2.15 + NETMASK=255.255.255.0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +@@ -3218,7 +3191,6 @@ USERCTL=no + # + BOOTPROTO=dhcp + DEVICE=eth0 +-NM_CONTROLLED=no + ONBOOT=yes + TYPE=Ethernet + USERCTL=no +-- +2.27.0 + diff --git a/0003-limit-permissions-on-def_log_file.patch b/0003-limit-permissions-on-def_log_file.patch new file mode 100644 index 0000000..c9da2fd --- /dev/null +++ b/0003-limit-permissions-on-def_log_file.patch @@ -0,0 +1,69 @@ +From 680ebcb46d1db6f02f2b21c158b4a9af2d789ba3 Mon Sep 17 00:00:00 2001 +From: Eduardo Otubo +Date: Fri, 7 May 2021 13:36:08 +0200 +Subject: limit permissions on def_log_file + +This sets a default mode of 0600 on def_log_file, and makes this +configurable via the def_log_file_mode option in cloud.cfg. + +LP: #1541196 +Resolves: rhbz#1424612 +X-approved-upstream: true + +Conflicts 21.1: + cloudinit/stages.py: adjusting call of ensure_file() to use more +recent version + +Signed-off-by: Eduardo Otubo +--- + cloudinit/settings.py | 1 + + cloudinit/stages.py | 1 + + doc/examples/cloud-config.txt | 4 ++++ + 3 files changed, 6 insertions(+) + +diff --git a/cloudinit/settings.py b/cloudinit/settings.py +index e690c0fd..43a1490c 100644 +--- a/cloudinit/settings.py ++++ b/cloudinit/settings.py +@@ -46,6 +46,7 @@ CFG_BUILTIN = { + 'None', + ], + 'def_log_file': '/var/log/cloud-init.log', ++ 'def_log_file_mode': 0o600, + 'log_cfgs': [], + 'mount_default_fields': [None, None, 'auto', 'defaults,nofail', '0', '2'], + 'ssh_deletekeys': False, +diff --git a/cloudinit/stages.py b/cloudinit/stages.py +index 3ef4491c..83e25dd1 100644 +--- a/cloudinit/stages.py ++++ b/cloudinit/stages.py +@@ -147,6 +147,7 @@ class Init(object): + def _initialize_filesystem(self): + util.ensure_dirs(self._initial_subdirs()) + log_file = util.get_cfg_option_str(self.cfg, 'def_log_file') ++ log_file_mode = util.get_cfg_option_int(self.cfg, 'def_log_file_mode') + if log_file: + util.ensure_file(log_file, preserve_mode=True) + perms = self.cfg.get('syslog_fix_perms') +diff --git a/doc/examples/cloud-config.txt b/doc/examples/cloud-config.txt +index de9a0f87..bb33ad45 100644 +--- a/doc/examples/cloud-config.txt ++++ b/doc/examples/cloud-config.txt +@@ -414,10 +414,14 @@ timezone: US/Eastern + # if syslog_fix_perms is a list, it will iterate through and use the + # first pair that does not raise error. + # ++# 'def_log_file' will be created with mode 'def_log_file_mode', which ++# is specified as a numeric value and defaults to 0600. ++# + # the default values are '/var/log/cloud-init.log' and 'syslog:adm' + # the value of 'def_log_file' should match what is configured in logging + # if either is empty, then no change of ownership will be done + def_log_file: /var/log/my-logging-file.log ++def_log_file_mode: 0600 + syslog_fix_perms: syslog:root + + # you can set passwords for a user or multiple users +-- +2.27.0 + diff --git a/README.rst b/README.rst deleted file mode 100644 index fbd67ca..0000000 --- a/README.rst +++ /dev/null @@ -1,18 +0,0 @@ -=================== -cloud-init development -=================== - -cloud-init is maintained in a `source tree`_ rather than directly in dist-git -using packit service that provides way to develope using regular source code -structure and provides way to generate SRPM and build using koji service. - -Developers deliver all changes to source-git using merge request. Only maintainers -will be pushing changes sent to source-git to dist-git. - -Each release in dist-git is tagged in the source repository so you can easily -check out the source tree for a build. The tags are in the format -name-version-release, but note release doesn't contain the dist tag since the -source can be built in different build roots (Fedora, CentOS, etc.) - -.. _source tree: https://gitlab.com/redhat/centos-stream/src/cloud-init - diff --git a/cloud-init-20.4-Adding-RHEL-default-cloud.cfg.patch b/cloud-init-20.4-Adding-RHEL-default-cloud.cfg.patch deleted file mode 100644 index 214f93a..0000000 --- a/cloud-init-20.4-Adding-RHEL-default-cloud.cfg.patch +++ /dev/null @@ -1,88 +0,0 @@ -From d46ac3af1e964916f65dd920fc54bd8c0c8e32de Mon Sep 17 00:00:00 2001 -From: Eduardo Otubo -Date: Thu, 10 Dec 2020 17:43:15 +0100 -Subject: [PATCH] Adding RHEL default cloud.cfg - ---- - rhel/cloud.cfg | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 69 insertions(+) - create mode 100644 rhel/cloud.cfg - -diff --git a/rhel/cloud.cfg b/rhel/cloud.cfg -new file mode 100644 -index 00000000..9ecba215 ---- /dev/null -+++ b/rhel/cloud.cfg -@@ -0,0 +1,69 @@ -+users: -+ - default -+ -+disable_root: 1 -+ssh_pwauth: 0 -+ -+mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2'] -+resize_rootfs_tmp: /dev -+ssh_deletekeys: 1 -+ssh_genkeytypes: ~ -+syslog_fix_perms: ~ -+disable_vmware_customization: false -+ -+cloud_init_modules: -+ - disk_setup -+ - migrator -+ - bootcmd -+ - write-files -+ - growpart -+ - resizefs -+ - set_hostname -+ - update_hostname -+ - update_etc_hosts -+ - rsyslog -+ - users-groups -+ - ssh -+ -+cloud_config_modules: -+ - mounts -+ - locale -+ - set-passwords -+ - rh_subscription -+ - yum-add-repo -+ - package-update-upgrade-install -+ - timezone -+ - puppet -+ - chef -+ - salt-minion -+ - mcollective -+ - disable-ec2-metadata -+ - runcmd -+ -+cloud_final_modules: -+ - rightscale_userdata -+ - scripts-per-once -+ - scripts-per-boot -+ - scripts-per-instance -+ - scripts-user -+ - ssh-authkey-fingerprints -+ - keys-to-console -+ - phone-home -+ - final-message -+ - power-state-change -+ -+system_info: -+ default_user: -+ name: cloud-user -+ lock_passwd: true -+ gecos: Cloud User -+ groups: [adm, systemd-journal] -+ sudo: ["ALL=(ALL) NOPASSWD:ALL"] -+ shell: /bin/bash -+ distro: rhel -+ paths: -+ cloud_dir: /var/lib/cloud -+ templates_dir: /etc/cloud/templates -+ ssh_svcname: sshd -+ -+# vim:syntax=yaml --- -2.27.0 - diff --git a/cloud-init-20.4-disable-lxd-tests.patch b/cloud-init-20.4-disable-lxd-tests.patch deleted file mode 100644 index 4a07063..0000000 --- a/cloud-init-20.4-disable-lxd-tests.patch +++ /dev/null @@ -1,33 +0,0 @@ -From f70a9a0a98c0af5a7b2aea9a8e4b40bbe1668038 Mon Sep 17 00:00:00 2001 -From: Eduardo Otubo -Date: Thu, 3 Dec 2020 12:31:42 +0100 -Subject: [PATCH 1/3] Disable LXD tests - -Signed-off-by: Eduardo Otubo ---- - tests/cloud_tests/platforms/__init__.py | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/tests/cloud_tests/platforms/__init__.py b/tests/cloud_tests/platforms/__init__.py -index e506baa0..e7efcba5 100644 ---- a/tests/cloud_tests/platforms/__init__.py -+++ b/tests/cloud_tests/platforms/__init__.py -@@ -3,7 +3,6 @@ - """Main init.""" - - from .ec2 import platform as ec2 --from .lxd import platform as lxd - from .nocloudkvm import platform as nocloudkvm - from .azurecloud import platform as azurecloud - from ..util import emit_dots_on_travis -@@ -11,7 +10,6 @@ from ..util import emit_dots_on_travis - PLATFORMS = { - 'ec2': ec2.EC2Platform, - 'nocloud-kvm': nocloudkvm.NoCloudKVMPlatform, -- 'lxd': lxd.LXDPlatform, - 'azurecloud': azurecloud.AzureCloudPlatform, - } - --- -2.27.0 - diff --git a/cloud-init-20.4-nm-controlled.patch b/cloud-init-20.4-nm-controlled.patch deleted file mode 100644 index 606e7bc..0000000 --- a/cloud-init-20.4-nm-controlled.patch +++ /dev/null @@ -1,500 +0,0 @@ -From 8256852de570a0c6b237c75abd134ddbafee5c1f Mon Sep 17 00:00:00 2001 -From: Eduardo Otubo -Date: Thu, 3 Dec 2020 12:31:50 +0100 -Subject: [PATCH] Do not write NM_CONTROLLED=no in generated interface config - files - -Conflicts 20.3: - - Not appplying patch on cloudinit/net/sysconfig.py since it now has a -mechanism to identify if cloud-init is running on RHEL, having the -correct settings for NM_CONTROLLED. - -X-downstream-only: true -Signed-off-by: Eduardo Otubo -Signed-off-by: Ryan McCabe ---- - cloudinit/net/sysconfig.py | 2 +- - .../unittests/test_distros/test_netconfig.py | 8 --- - tests/unittests/test_net.py | 49 ------------------- - 3 files changed, 1 insertion(+), 58 deletions(-) - -diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py -index a930e612..9c822c3e 100644 ---- a/cloudinit/net/sysconfig.py -+++ b/cloudinit/net/sysconfig.py -@@ -289,7 +289,7 @@ class Renderer(renderer.Renderer): - # details about this) - - iface_defaults = { -- 'rhel': {'ONBOOT': True, 'USERCTL': False, 'NM_CONTROLLED': False, -+ 'rhel': {'ONBOOT': True, 'USERCTL': False, - 'BOOTPROTO': 'none'}, - 'suse': {'BOOTPROTO': 'static', 'STARTMODE': 'auto'}, - } -diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py -index a1df066a..bc167f94 100644 ---- a/tests/unittests/test_distros/test_netconfig.py -+++ b/tests/unittests/test_distros/test_netconfig.py -@@ -484,7 +484,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): - GATEWAY=192.168.1.254 - IPADDR=192.168.1.5 - NETMASK=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -492,7 +491,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): - self.ifcfg_path('eth1'): dedent("""\ - BOOTPROTO=dhcp - DEVICE=eth1 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -517,7 +515,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): - IPV6_AUTOCONF=no - IPV6_DEFAULTGW=2607:f0d0:1002:0011::1 - IPV6_FORCE_ACCEPT_RA=no -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -525,7 +522,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): - self.ifcfg_path('eth1'): dedent("""\ - BOOTPROTO=dhcp - DEVICE=eth1 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -559,7 +555,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): - HWADDR=00:16:3e:60:7c:df - IPADDR=192.10.1.2 - NETMASK=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -569,7 +564,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): - DEVICE=infra0 - IPADDR=10.0.1.2 - NETMASK=255.255.0.0 -- NM_CONTROLLED=no - ONBOOT=yes - PHYSDEV=eth0 - USERCTL=no -@@ -598,7 +592,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): - DEVICE=eth0 - IPADDR=192.10.1.2 - NETMASK=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -608,7 +601,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase): - DEVICE=eth0.1001 - IPADDR=10.0.1.2 - NETMASK=255.255.0.0 -- NM_CONTROLLED=no - ONBOOT=yes - PHYSDEV=eth0 - USERCTL=no -diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py -index 70453683..47a71964 100644 ---- a/tests/unittests/test_net.py -+++ b/tests/unittests/test_net.py -@@ -535,7 +535,6 @@ GATEWAY=172.19.3.254 - HWADDR=fa:16:3e:ed:9a:59 - IPADDR=172.19.1.34 - NETMASK=255.255.252.0 --NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -633,7 +632,6 @@ IPADDR=172.19.1.34 - IPADDR1=10.0.0.10 - NETMASK=255.255.252.0 - NETMASK1=255.255.255.0 --NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -756,7 +754,6 @@ IPV6_AUTOCONF=no - IPV6_DEFAULTGW=2001:DB8::1 - IPV6_FORCE_ACCEPT_RA=no - NETMASK=255.255.252.0 --NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -884,7 +881,6 @@ NETWORK_CONFIGS = { - BOOTPROTO=none - DEVICE=eth1 - HWADDR=cf:d6:af:48:e8:80 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no"""), -@@ -901,7 +897,6 @@ NETWORK_CONFIGS = { - IPADDR=192.168.21.3 - NETMASK=255.255.255.0 - METRIC=10000 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no"""), -@@ -1032,7 +1027,6 @@ NETWORK_CONFIGS = { - IPV6_AUTOCONF=no - IPV6_FORCE_ACCEPT_RA=no - NETMASK=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -1095,7 +1089,6 @@ NETWORK_CONFIGS = { - DHCPV6C=yes - IPV6INIT=yes - DEVICE=iface0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -1150,7 +1143,6 @@ NETWORK_CONFIGS = { - IPV6INIT=yes - IPV6_FORCE_ACCEPT_RA=yes - DEVICE=iface0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -1205,7 +1197,6 @@ NETWORK_CONFIGS = { - IPV6INIT=yes - IPV6_FORCE_ACCEPT_RA=no - DEVICE=iface0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -1250,7 +1241,6 @@ NETWORK_CONFIGS = { - IPV6_AUTOCONF=yes - IPV6INIT=yes - DEVICE=iface0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -1277,7 +1267,6 @@ NETWORK_CONFIGS = { - IPV6_AUTOCONF=no - IPV6_FORCE_ACCEPT_RA=no - DEVICE=iface0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -1324,7 +1313,6 @@ NETWORK_CONFIGS = { - IPV6_AUTOCONF=yes - IPV6INIT=yes - DEVICE=iface0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -1371,7 +1359,6 @@ NETWORK_CONFIGS = { - IPV6INIT=yes - IPV6_FORCE_ACCEPT_RA=yes - DEVICE=iface0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -1404,7 +1391,6 @@ NETWORK_CONFIGS = { - 'ifcfg-iface0': textwrap.dedent("""\ - BOOTPROTO=dhcp - DEVICE=iface0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -1447,7 +1433,6 @@ NETWORK_CONFIGS = { - BOOTPROTO=dhcp - DEVICE=iface0 - ETHTOOL_OPTS="wol g" -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -1736,7 +1721,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - DHCPV6C=yes - IPV6INIT=yes - MACADDR=aa:bb:cc:dd:ee:ff -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Bond - USERCTL=no"""), -@@ -1744,7 +1728,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - BOOTPROTO=dhcp - DEVICE=bond0.200 - DHCLIENT_SET_DEFAULT_ROUTE=no -- NM_CONTROLLED=no - ONBOOT=yes - PHYSDEV=bond0 - USERCTL=no -@@ -1762,7 +1745,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - IPV6_DEFAULTGW=2001:4800:78ff:1b::1 - MACADDR=bb:bb:bb:bb:bb:aa - NETMASK=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - PRIO=22 - STP=no -@@ -1772,7 +1754,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - BOOTPROTO=none - DEVICE=eth0 - HWADDR=c0:d6:9f:2c:e8:80 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no"""), -@@ -1789,7 +1770,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - MTU=1500 - NETMASK=255.255.255.0 - NETMASK1=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - PHYSDEV=eth0 - USERCTL=no -@@ -1799,7 +1779,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - DEVICE=eth1 - HWADDR=aa:d6:9f:2c:e8:80 - MASTER=bond0 -- NM_CONTROLLED=no - ONBOOT=yes - SLAVE=yes - TYPE=Ethernet -@@ -1809,7 +1788,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - DEVICE=eth2 - HWADDR=c0:bb:9f:2c:e8:80 - MASTER=bond0 -- NM_CONTROLLED=no - ONBOOT=yes - SLAVE=yes - TYPE=Ethernet -@@ -1819,7 +1797,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - BRIDGE=br0 - DEVICE=eth3 - HWADDR=66:bb:9f:2c:e8:80 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no"""), -@@ -1828,7 +1805,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - BRIDGE=br0 - DEVICE=eth4 - HWADDR=98:bb:9f:2c:e8:80 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no"""), -@@ -1837,7 +1813,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - DEVICE=eth5 - DHCLIENT_SET_DEFAULT_ROUTE=no - HWADDR=98:bb:9f:2c:e8:8a -- NM_CONTROLLED=no - ONBOOT=no - TYPE=Ethernet - USERCTL=no"""), -@@ -1848,7 +1823,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true - IPADDR=192.168.200.7 - MTU=9000 - NETMASK=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=InfiniBand - USERCTL=no"""), -@@ -2293,7 +2267,6 @@ iface bond0 inet6 static - MTU=9000 - NETMASK=255.255.255.0 - NETMASK1=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Bond - USERCTL=no -@@ -2303,7 +2276,6 @@ iface bond0 inet6 static - DEVICE=bond0s0 - HWADDR=aa:bb:cc:dd:e8:00 - MASTER=bond0 -- NM_CONTROLLED=no - ONBOOT=yes - SLAVE=yes - TYPE=Ethernet -@@ -2325,7 +2297,6 @@ iface bond0 inet6 static - DEVICE=bond0s1 - HWADDR=aa:bb:cc:dd:e8:01 - MASTER=bond0 -- NM_CONTROLLED=no - ONBOOT=yes - SLAVE=yes - TYPE=Ethernet -@@ -2382,7 +2353,6 @@ iface bond0 inet6 static - BOOTPROTO=none - DEVICE=en0 - HWADDR=aa:bb:cc:dd:e8:00 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no"""), -@@ -2401,7 +2371,6 @@ iface bond0 inet6 static - MTU=2222 - NETMASK=255.255.255.0 - NETMASK1=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - PHYSDEV=en0 - USERCTL=no -@@ -2466,7 +2435,6 @@ iface bond0 inet6 static - DEVICE=br0 - IPADDR=192.168.2.2 - NETMASK=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - PRIO=22 - STP=no -@@ -2482,7 +2450,6 @@ iface bond0 inet6 static - IPV6INIT=yes - IPV6_AUTOCONF=no - IPV6_FORCE_ACCEPT_RA=no -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -2496,7 +2463,6 @@ iface bond0 inet6 static - IPV6INIT=yes - IPV6_AUTOCONF=no - IPV6_FORCE_ACCEPT_RA=no -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -2590,7 +2556,6 @@ iface bond0 inet6 static - HWADDR=52:54:00:12:34:00 - IPADDR=192.168.1.2 - NETMASK=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=no - TYPE=Ethernet - USERCTL=no -@@ -2600,7 +2565,6 @@ iface bond0 inet6 static - DEVICE=eth1 - HWADDR=52:54:00:12:34:aa - MTU=1480 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -2609,7 +2573,6 @@ iface bond0 inet6 static - BOOTPROTO=none - DEVICE=eth2 - HWADDR=52:54:00:12:34:ff -- NM_CONTROLLED=no - ONBOOT=no - TYPE=Ethernet - USERCTL=no -@@ -3026,7 +2989,6 @@ class TestRhelSysConfigRendering(CiTestCase): - BOOTPROTO=dhcp - DEVICE=eth1000 - HWADDR=07-1c-c6-75-a4-be --NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -3147,7 +3109,6 @@ GATEWAY=10.0.2.2 - HWADDR=52:54:00:12:34:00 - IPADDR=10.0.2.15 - NETMASK=255.255.255.0 --NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -3178,7 +3139,6 @@ HWADDR=fa:16:3e:25:b4:59 - IPADDR=51.68.89.122 - MTU=1500 - NETMASK=255.255.240.0 --NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -3192,7 +3152,6 @@ DEVICE=eth1 - DHCLIENT_SET_DEFAULT_ROUTE=no - HWADDR=fa:16:3e:b1:ca:29 - MTU=9000 --NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -3217,7 +3176,6 @@ USERCTL=no - # - BOOTPROTO=dhcp - DEVICE=eth0 --NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -3492,7 +3450,6 @@ USERCTL=no - IPV6_FORCE_ACCEPT_RA=no - IPV6_DEFAULTGW=2001:db8::1 - NETMASK=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -3517,7 +3474,6 @@ USERCTL=no - 'ifcfg-eno1': textwrap.dedent("""\ - BOOTPROTO=none - DEVICE=eno1 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no -@@ -3528,7 +3484,6 @@ USERCTL=no - IPADDR=192.6.1.9 - MTU=1495 - NETMASK=255.255.255.0 -- NM_CONTROLLED=no - ONBOOT=yes - PHYSDEV=eno1 - USERCTL=no -@@ -3558,7 +3513,6 @@ USERCTL=no - IPADDR=10.101.8.65 - MTU=1334 - NETMASK=255.255.255.192 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Bond - USERCTL=no -@@ -3568,7 +3522,6 @@ USERCTL=no - BOOTPROTO=none - DEVICE=enp0s0 - MASTER=bond0 -- NM_CONTROLLED=no - ONBOOT=yes - SLAVE=yes - TYPE=Bond -@@ -3579,7 +3532,6 @@ USERCTL=no - BOOTPROTO=none - DEVICE=enp0s1 - MASTER=bond0 -- NM_CONTROLLED=no - ONBOOT=yes - SLAVE=yes - TYPE=Bond -@@ -3603,7 +3555,6 @@ USERCTL=no - DEVICE=eno1 - HWADDR=07-1c-c6-75-a4-be - METRIC=100 -- NM_CONTROLLED=no - ONBOOT=yes - TYPE=Ethernet - USERCTL=no --- -2.27.0 - diff --git a/cloud-init-20.4-no-override-default-network.patch b/cloud-init-20.4-no-override-default-network.patch deleted file mode 100644 index 6e1ac7a..0000000 --- a/cloud-init-20.4-no-override-default-network.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 5514d5922cbc92278868bfea587c4207619d81fc Mon Sep 17 00:00:00 2001 -From: Eduardo Otubo -Date: Thu, 3 Dec 2020 12:34:01 +0100 -Subject: [PATCH 3/3] Don't override default network configuration - -Signed-off-by: Eduardo Otubo ---- - cloudinit/net/sysconfig.py | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py -index 9c822c3e..a240f65e 100644 ---- a/cloudinit/net/sysconfig.py -+++ b/cloudinit/net/sysconfig.py -@@ -918,7 +918,17 @@ class Renderer(renderer.Renderer): - # Distros configuring /etc/sysconfig/network as a file e.g. Centos - if sysconfig_path.endswith('network'): - util.ensure_dir(os.path.dirname(sysconfig_path)) -- netcfg = [_make_header(), 'NETWORKING=yes'] -+ # Make sure that existing lines, other than overriding ones, remain -+ netcfg = [] -+ for line in util.load_file(sysconfig_path, quiet=True).split('\n'): -+ if 'cloud-init' in line: -+ break -+ if not line.startswith(('NETWORKING=', -+ 'IPV6_AUTOCONF=', -+ 'NETWORKING_IPV6=')): -+ netcfg.append(line) -+ # Now generate the cloud-init portion of sysconfig/network -+ netcfg.extend([_make_header(), 'NETWORKING=yes']) - if network_state.use_ipv6: - netcfg.append('NETWORKING_IPV6=yes') - netcfg.append('IPV6_AUTOCONF=no') --- -2.27.0 - diff --git a/cloud-init-20.4-sandbox-ca_certs-tests-to-avoid-failure.patch b/cloud-init-20.4-sandbox-ca_certs-tests-to-avoid-failure.patch deleted file mode 100644 index 20f27e3..0000000 --- a/cloud-init-20.4-sandbox-ca_certs-tests-to-avoid-failure.patch +++ /dev/null @@ -1,46 +0,0 @@ -From f16b18607444cb41e263edfa7fb0c97ba1f7e518 Mon Sep 17 00:00:00 2001 -From: Eduardo Otubo -Date: Fri, 4 Dec 2020 11:05:08 +0100 -Subject: [PATCH] Sandbox ca_certs tests to avoid failure - -Signed-off-by: Eduardo Otubo ---- - .../unittests/test_handler/test_handler_ca_certs.py | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) - -diff --git a/tests/unittests/test_handler/test_handler_ca_certs.py b/tests/unittests/test_handler/test_handler_ca_certs.py -index e74a0a08..a16430d5 100644 ---- a/tests/unittests/test_handler/test_handler_ca_certs.py -+++ b/tests/unittests/test_handler/test_handler_ca_certs.py -@@ -152,6 +152,7 @@ class TestAddCaCerts(TestCase): - self.paths = helpers.Paths({ - 'cloud_dir': tmpdir, - }) -+ self.add_patch("cloudinit.config.cc_ca_certs.os.stat", "m_stat") - - def test_no_certs_in_list(self): - """Test that no certificate are written if not provided.""" -@@ -215,17 +216,12 @@ class TestAddCaCerts(TestCase): - - expected = "cloud-init-ca-certs.crt\n" - -- with ExitStack() as mocks: -- mock_write = mocks.enter_context( -- mock.patch.object(util, 'write_file', autospec=True)) -- mock_stat = mocks.enter_context( -- mock.patch("cloudinit.config.cc_ca_certs.os.stat") -- ) -- mock_stat.return_value.st_size = 0 -+ with mock.patch.object(util, 'write_file', autospec=True) as m_write: -+ self.m_stat.return_value.st_size = 0 - - cc_ca_certs.add_ca_certs([cert]) - -- mock_write.assert_has_calls([ -+ m_write.assert_has_calls([ - mock.call("/usr/share/ca-certificates/cloud-init-ca-certs.crt", - cert, mode=0o644), - mock.call("/etc/ca-certificates.conf", expected, omode="wb")]) --- -2.27.0 - diff --git a/cloud-init.spec b/cloud-init.spec index 1b5fbf9..77e27ab 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,32 +1,15 @@ Name: cloud-init -Version: 20.4 -Release: 5%{?dist} +Version: 21.1 +Release: 1%{?dist} Summary: Cloud instance init scripts License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init - Source0: https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz Source1: cloud-init-tmpfiles.conf -# Disable tests that require pylxd, which we don't have on Fedora -Patch1: cloud-init-20.4-disable-lxd-tests.patch - -# Do not write NM_CONTROLLED=no in generated interface config files -# https://bugzilla.redhat.com/show_bug.cgi?id=1385172 -Patch2: cloud-init-20.4-nm-controlled.patch - -# Keep old properties in /etc/sysconfig/network -# https://bugzilla.redhat.com/show_bug.cgi?id=1558641 -Patch3: cloud-init-20.4-no-override-default-network.patch - -# ca_cert tests are failing because Fedora doesn't include those files -# by default. This will be upstream soon and we can drop this patch, or -# replace by its backport. For now I'll leave this here so the koji ci don't -# fail -Patch4: cloud-init-20.4-sandbox-ca_certs-tests-to-avoid-failure.patch - -# Adding default RHEL configuration file -Patch5: cloud-init-20.4-Adding-RHEL-default-cloud.cfg.patch +Patch0001: 0001-Add-initial-redhat-setup.patch +Patch0002: 0002-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch +Patch0003: 0003-limit-permissions-on-def_log_file.patch BuildArch: noarch @@ -36,9 +19,7 @@ BuildRequires: python3-setuptools BuildRequires: systemd # For tests -BuildRequires: python3-pytest BuildRequires: iproute -BuildRequires: passwd BuildRequires: python3-configobj # https://bugzilla.redhat.com/show_bug.cgi?id=1695953 BuildRequires: python3-distro @@ -46,7 +27,6 @@ BuildRequires: python3-distro BuildRequires: python3-httpretty >= 0.8.14-2 BuildRequires: python3-jinja2 BuildRequires: python3-jsonpatch -BuildRequires: python3-jsonschema BuildRequires: python3-oauthlib BuildRequires: python3-prettytable BuildRequires: python3-pyserial @@ -59,8 +39,7 @@ BuildRequires: /usr/bin/dnf Requires: e2fsprogs Requires: iproute -Requires: python3-libselinux -Requires: net-tools +Requires: libselinux-python3 Requires: policycoreutils-python3 Requires: procps Requires: python3-configobj @@ -68,7 +47,6 @@ Requires: python3-configobj Requires: python3-distro Requires: python3-jinja2 Requires: python3-jsonpatch -Requires: python3-jsonschema Requires: python3-oauthlib Requires: python3-prettytable Requires: python3-pyserial @@ -81,7 +59,6 @@ Requires: xfsprogs %{?systemd_requires} - %description Cloud-init is a set of init scripts for cloud instances. Cloud instances need special scripts to run during initialization to retrieve and install @@ -95,20 +72,12 @@ ssh keys and to let the user run various scripts. sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/env python3|' \ -e 's|#!/usr/bin/python|#!/usr/bin/python3|' tools/* cloudinit/ssh_util.py -# Removing shebang manually because of rpmlint, will update upstream later -sed -i -e 's|#!/usr/bin/python||' cloudinit/cmd/main.py - -# Use unittest from the standard library. unittest2 is old and being -# retired in Fedora. See https://bugzilla.redhat.com/show_bug.cgi?id=1794222 -find cloudinit/tests/ tests/ -type f | xargs sed -i s/unittest2/unittest/ -find cloudinit/tests/ tests/ -type f | xargs sed -i s/assertItemsEqual/assertCountEqual/ - %build %py3_build %install -%py3_install -- --init-system=systemd +%py3_install -- %if 0%{?fedora} python3 tools/render-cloudcfg --variant fedora > $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg @@ -123,59 +92,122 @@ mkdir -p $RPM_BUILD_ROOT/run/cloud-init mkdir -p $RPM_BUILD_ROOT/%{_tmpfilesdir} cp -p %{SOURCE1} $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf +# We supply our own config file since our software differs from Ubuntu's. +cp -p rhel/cloud.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg + mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d cp -p tools/21-cloudinit.conf $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf +# Make installed NetworkManager hook name less generic +mv $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/hook-network-manager \ + $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/cloud-init-azure-hook + +# Install our own systemd units (rhbz#1440831) +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +cp rhel/systemd/* $RPM_BUILD_ROOT%{_unitdir}/ + +[ ! -d $RPM_BUILD_ROOT/usr/lib/systemd/system-generators ] && mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system-generators +python3 tools/render-cloudcfg --variant rhel systemd/cloud-init-generator.tmpl > $RPM_BUILD_ROOT/usr/lib/systemd/system-generators/cloud-init-generator +chmod 755 $RPM_BUILD_ROOT/usr/lib/systemd/system-generators/cloud-init-generator + +[ ! -d $RPM_BUILD_ROOT/usr/lib/%{name} ] && mkdir -p $RPM_BUILD_ROOT/usr/lib/%{name} +cp -p tools/ds-identify $RPM_BUILD_ROOT%{_libexecdir}/%{name}/ds-identify + +# installing man pages +mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1/ +for man in cloud-id.1 cloud-init.1 cloud-init-per.1; do + install -c -m 0644 doc/man/${man} ${RPM_BUILD_ROOT}%{_mandir}/man1/${man} + chmod -x ${RPM_BUILD_ROOT}%{_mandir}/man1/* +done + +%clean +rm -rf $RPM_BUILD_ROOT -%check -python3 -m pytest tests/unittests %post -%systemd_post cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service +if [ $1 -eq 1 ] ; then + # Initial installation + # Enabled by default per "runs once then goes away" exception + /bin/systemctl enable cloud-config.service >/dev/null 2>&1 || : + /bin/systemctl enable cloud-final.service >/dev/null 2>&1 || : + /bin/systemctl enable cloud-init.service >/dev/null 2>&1 || : + /bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || : + /bin/systemctl enable cloud-init.target >/dev/null 2>&1 || : +elif [ $1 -eq 2 ]; then + # Upgrade. If the upgrade is from a version older than 0.7.9-8, + # there will be stale systemd config + /bin/systemctl is-enabled cloud-config.service >/dev/null 2>&1 && + /bin/systemctl reenable cloud-config.service >/dev/null 2>&1 || : + /bin/systemctl is-enabled cloud-final.service >/dev/null 2>&1 && + /bin/systemctl reenable cloud-final.service >/dev/null 2>&1 || : + + /bin/systemctl is-enabled cloud-init.service >/dev/null 2>&1 && + /bin/systemctl reenable cloud-init.service >/dev/null 2>&1 || : + + /bin/systemctl is-enabled cloud-init-local.service >/dev/null 2>&1 && + /bin/systemctl reenable cloud-init-local.service >/dev/null 2>&1 || : + + /bin/systemctl is-enabled cloud-init.target >/dev/null 2>&1 && + /bin/systemctl reenable cloud-init.target >/dev/null 2>&1 || : +fi %preun -%systemd_preun cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service - +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || : + /bin/systemctl --no-reload disable cloud-final.service >/dev/null 2>&1 || : + /bin/systemctl --no-reload disable cloud-init.service >/dev/null 2>&1 || : + /bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || : + /bin/systemctl --no-reload disable cloud-init.target >/dev/null 2>&1 || : + # One-shot services -> no need to stop +fi %postun %systemd_postun cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service %files -%license LICENSE LICENSE-Apache2.0 LICENSE-GPLv3 -%doc ChangeLog -%doc doc/* +%license LICENSE +%doc ChangeLog rhel/README.rhel %config(noreplace) %{_sysconfdir}/cloud/cloud.cfg %dir %{_sysconfdir}/cloud/cloud.cfg.d %config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg %doc %{_sysconfdir}/cloud/cloud.cfg.d/README %dir %{_sysconfdir}/cloud/templates %config(noreplace) %{_sysconfdir}/cloud/templates/* -%dir %{_sysconfdir}/rsyslog.d -%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf -%{_sysconfdir}/NetworkManager/dispatcher.d/hook-network-manager -%{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient -/lib/udev/rules.d/66-azure-ephemeral.rules %{_unitdir}/cloud-config.service -%{_unitdir}/cloud-final.service -%{_unitdir}/cloud-init.service -%{_unitdir}/cloud-init-local.service %{_unitdir}/cloud-config.target +%{_unitdir}/cloud-final.service +%{_unitdir}/cloud-init-local.service +%{_unitdir}/cloud-init.service %{_unitdir}/cloud-init.target -/usr/lib/systemd/system-generators/cloud-init-generator %{_tmpfilesdir}/%{name}.conf %{python3_sitelib}/* %{_libexecdir}/%{name} %{_bindir}/cloud-init* -%{_bindir}/cloud-id -%dir /run/cloud-init +%doc %{_datadir}/doc/%{name} +%{_mandir}/man1/* +%dir %verify(not mode) /run/cloud-init %dir /var/lib/cloud -%{_datadir}/bash-completion/completions/cloud-init +/etc/NetworkManager/dispatcher.d/cloud-init-azure-hook +%{_udevrulesdir}/66-azure-ephemeral.rules +%{_sysconfdir}/bash_completion.d/cloud-init +%{_bindir}/cloud-id +%{_libexecdir}/%{name}/ds-identify +/usr/lib/systemd/system-generators/cloud-init-generator +%dir %{_sysconfdir}/rsyslog.d +%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf + %changelog -* Wed Apr 21 2021 Miroslav Rezanina +* Thu Jun 10 2021 Miroslav Rezanina - 21.1-1 +- Rebase to 21.1 [bz#1958209] +- Resolves: bz#1958209 + ([RHEL-9.0] Rebase cloud-init to 21.1) + +* Wed Apr 21 2021 Miroslav Rezanina - 20.4-5 - Removing python-mock dependency - Resolves: bz#1922323 @@ -278,251 +310,76 @@ python3 -m pytest tests/unittests * Wed Oct 4 2017 Garrett Holmstrom - 17.1-1 - Updated to 17.1 -* Fri Sep 15 2017 Dusty Mabe - 0.7.9-9 -- Fix issues with growing xfs filesystems [RH:1490505] -- Add in hook-dhclient to help enable azure [RH:1477333] +* Tue Sep 26 2017 Ryan McCabe 0.7.9-10 +- AliCloud: Add support for the Alibaba Cloud datasource (rhbz#1482547) -* Wed Jul 26 2017 Fedora Release Engineering - 0.7.9-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild +* Thu Jun 22 2017 Lars Kellogg-Stedman 0.7.9-9 +- RHEL/CentOS: Fix default routes for IPv4/IPv6 configuration. (rhbz#1438082) +- azure: ensure that networkmanager hook script runs (rhbz#1440831 rhbz#1460206) +- Fix ipv6 subnet detection (rhbz#1438082) -* Tue Jun 27 2017 Garrett Holmstrom - 0.7.9-7 -- Fixed broken sysconfig file writing on DigitalOcean [RH:1465440] +* Tue May 23 2017 Lars Kellogg-Stedman 0.7.9-8 +- Update patches -* Wed Jun 21 2017 Garrett Holmstrom - 0.7.9-6 -- Fixed NameError in package module [RH:1447708] -- Resolved a conflict between cloud-init and NetworkManager writing resolv.conf [RH:1454491 RH:1461959 LP:1693251] -- Fixed broken fs_setup cmd option [LP:1687712] +* Mon May 22 2017 Lars Kellogg-Stedman 0.7.9-7 +- Add missing sysconfig unit test data (rhbz#1438082) +- Fix dual stack IPv4/IPv6 configuration for RHEL (rhbz#1438082) +- sysconfig: Raise ValueError when multiple default gateways are present. (rhbz#1438082) +- Bounce network interface for Azure when using the built-in path. (rhbz#1434109) +- Do not write NM_CONTROLLED=no in generated interface config files (rhbz#1385172) -* Fri Apr 14 2017 Garrett Holmstrom - 0.7.9-5 -- Made DigitalOcean DNS server handling consistent with OpenStack [RH:1442463, LP:1675571] -- Improved handling of multiple NICs on DigitalOcean [RH:1442463] -- Assign link-local IPV4 addresses in DigitalOcean based on interface indexes [RH:1442463] +* Wed May 10 2017 Lars Kellogg-Stedman 0.7.9-6 +- add power-state-change module to cloud_final_modules (rhbz#1252477) +- remove 'tee' command from logging configuration (rhbz#1424612) +- limit permissions on def_log_file (rhbz#1424612) +- Bounce network interface for Azure when using the built-in path. (rhbz#1434109) +- OpenStack: add 'dvs' to the list of physical link types. (rhbz#1442783) -* Tue Mar 14 2017 Garrett Holmstrom - 0.7.9-4 -- Fixed systemd dependency cycle with cloud-final and os-collect-config [RH:1420946, RH:1428492] -- Fixed systemd dependency cycle with cloud-init and multi-user.target [RH:1428492, RH:1430511] -- Fixed errors in network sysconfig handling [RH:1389530, LP:1665441] -- Made > 3 name servers a warning, not a fatal error, unbreaking IPv6 setups [LP:1670052] -- Fixed IPv6 gateways in network sysconfig [LP:1669504] -- Ordered cloud-init.service after network.service and NetworkManager.service [RH:1400249] +* Wed May 10 2017 Lars Kellogg-Stedman 0.7.9-5 +- systemd: replace generator with unit conditionals (rhbz#1440831) -* Tue Mar 14 2017 Garrett Holmstrom - 0.7.8-6 -- Ordered cloud-init.service after network.service and NetworkManager.service [RH:1400249] -- Stopped caching IAM instance profile credentials on disk [LP:1638312] +* Thu Apr 13 2017 Charalampos Stratakis 0.7.9-4 +- Import to RHEL 7 +Resolves: rhbz#1427280 -* Fri Feb 10 2017 Fedora Release Engineering - 0.7.9-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild +* Tue Mar 07 2017 Lars Kellogg-Stedman 0.7.9-3 +- fixes for network config generation +- avoid dependency cycle at boot (rhbz#1420946) -* Fri Jan 27 2017 Garrett Holmstrom - 0.7.9-2 -- Fixed hostnamectl running before dbus is up [RH:1417025] +* Tue Jan 17 2017 Lars Kellogg-Stedman 0.7.9-2 +- use timeout from datasource config in openstack get_data (rhbz#1408589) -* Fri Jan 27 2017 Garrett Holmstrom - 0.7.8-5 -- Re-applied rsyslog configuration fixes -- Disabled GCE tests broken by python-httpretty-0.8.14-1.20161011git70af1f8 -- Fixed systemd dependency loop for cloud-init.target [RH:1393094] +* Thu Dec 01 2016 Lars Kellogg-Stedman - 0.7.9-1 +- Rebased on upstream 0.7.9. +- Remove dependency on run-parts -* Fri Jan 20 2017 Colin Walters - 0.7.9-1 -- New upstream version [RH:1393094] +* Wed Jan 06 2016 Lars Kellogg-Stedman - 0.7.6-8 +- make rh_subscription plugin do nothing in the absence of a valid + configuration [RH:1295953] +- move rh_subscription module to cloud_config stage -* Tue Dec 13 2016 Charalampos Stratakis - 0.7.8-4 -- Rebuild for Python 3.6 +* Wed Jan 06 2016 Lars Kellogg-Stedman - 0.7.6-7 +- correct permissions on /etc/ssh/sshd_config [RH:1296191] -* Tue Oct 25 2016 Garrett Holmstrom - 0.7.8-3 -- Enabled the DigitalOcean metadata provider by default [RH:1388568] +* Thu Sep 03 2015 Lars Kellogg-Stedman - 0.7.6-6 +- rebuild for ppc64le -* Fri Oct 14 2016 Garrett Holmstrom - 0.7.8-2 -- Stopped writing NM_CONTROLLED=no to interface config files [RH:1385172] +* Tue Jul 07 2015 Lars Kellogg-Stedman - 0.7.6-5 +- bump revision for new build -* Thu Sep 29 2016 Garrett Holmstrom - 0.7.8-1 -- Updated to 0.7.8 -- Dropped run-parts dependency [RH:1355917] -- Ordered cloud-init-local before NetworkManager -- Backported DigitalOcean network configuration support [RH:1380489] -- Added xfsprogs dependency for Fedora Server's default filesystem +* Tue Jul 07 2015 Lars Kellogg-Stedman - 0.7.6-4 +- ensure rh_subscription plugin is enabled by default -* Tue Aug 30 2016 Garrett Holmstrom - 0.7.7-1 -- Updated to 0.7.7 +* Wed Apr 29 2015 Lars Kellogg-Stedman - 0.7.6-3 +- added dependency on python-jinja2 [RH:1215913] +- added rhn_subscription plugin [RH:1227393] +- require pyserial to support smartos data source [RH:1226187] -* Tue Jul 19 2016 Fedora Release Engineering - 0.7.6-10.20160622bzr1245 -- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages +* Fri Jan 16 2015 Lars Kellogg-Stedman - 0.7.6-2 +- Rebased RHEL version to Fedora rawhide +- Backported fix for https://bugs.launchpad.net/cloud-init/+bug/1246485 +- Backported fix for https://bugs.launchpad.net/cloud-init/+bug/1411829 -* Wed Jul 6 2016 Garrett Holmstrom - 0.7.6-20160622bzr1245 -- Updated to bzr snapshot 1245 - -* Wed Feb 03 2016 Fedora Release Engineering - 0.7.6-8.20150813bzr1137 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Tue Nov 10 2015 Fedora Release Engineering - 0.7.6-7.20150813bzr1137 -- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 - -* Thu Aug 13 2015 Garrett Holmstrom - 0.7.6-6.20150813bzr1137 -- Updated to bzr snapshot 1137 - -* Wed Jun 17 2015 Fedora Release Engineering - 0.7.6-5.20140218bzr1060 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - -* Sat Feb 21 2015 Garrett Holmstrom - 0.7.6-4.20140218bzr1060 -- Updated to bzr snapshot 1060 for python 3 support -- Switched to python 3 [RH:1024357] -- Added %%check -- Dropped dmidecode dependency, switched back to noarch - -* Thu Feb 19 2015 Garrett Holmstrom - 0.7.6-3 -- Stopped depending on git to build -- Stopped implicitly listing doc files twice -- Added recognition of 3 ecdsa-sha2-nistp* ssh key types [RH:1151824] -- Fixed handling of user group lists that contain spaces [RH:1126365 LP:1354694] -- Changed network.target systemd deps to network-online.target [RH:1110731 RH:1112817 RH:1147613] -- Fixed race condition between cloud-init.service and the login prompt -- Stopped enabling services in %%post (now done by kickstart) [RH:850058] -- Switched to dnf instead of yum when available [RH:1194451] - -* Fri Nov 14 2014 Colin Walters - 0.7.6-2 +* Fri Nov 14 2014 Colin Walters - 0.7.6-1 - New upstream version [RH:974327] - Drop python-cheetah dependency (same as above bug) - -* Fri Nov 7 2014 Garrett Holmstrom - 0.7.5-8 -- Dropped python-boto dependency [RH:1161257] -- Dropped rsyslog dependency [RH:986511] - -* Sat Aug 16 2014 Fedora Release Engineering - 0.7.5-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild - -* Thu Jun 12 2014 Dennis Gilmore - 0.7.5-6 -- fix typo in settings.py preventing metadata being fecthed in ec2 - -* Mon Jun 9 2014 Garrett Holmstrom - 0.7.5-5 -- Stopped calling ``udevadm settle'' with --quiet since systemd 213 removed it - -* Sat Jun 07 2014 Fedora Release Engineering - 0.7.5-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - -* Mon Jun 2 2014 Garrett Holmstrom - 0.7.5-3 -- Make dmidecode dependency arch-dependent [RH:1025071 RH:1067089] - -* Mon Jun 2 2014 Garrett Holmstrom - 0.7.2-9 -- Write /etc/locale.conf instead of /etc/sysconfig/i18n [RH:1008250] -- Add tmpfiles.d configuration for /run/cloud-init [RH:1103761] -- Use the license rpm macro -- BuildRequire python-setuptools, not python-setuptools-devel - -* Fri May 30 2014 Matthew Miller - 0.7.5-2 -- add missing python-jsonpatch dependency [RH:1103281] - -* Tue Apr 29 2014 Sam Kottler - 0.7.5-1 -- Update to 0.7.5 and remove patches which landed in the release - -* Sat Jan 25 2014 Sam Kottler - 0.7.2-8 -- Remove patch to the Puppet service unit nane [RH:1057860] - -* Tue Sep 24 2013 Garrett Holmstrom - 0.7.2-7 -- Dropped xfsprogs dependency [RH:974329] - -* Tue Sep 24 2013 Garrett Holmstrom - 0.7.2-6 -- Added yum-add-repo module - -* Fri Sep 20 2013 Garrett Holmstrom - 0.7.2-5 -- Fixed puppet agent service name [RH:1008250] -- Let systemd handle console output [RH:977952 LP:1228434] -- Fixed restorecon failure when selinux is disabled [RH:967002 LP:1228441] -- Fixed rsyslog log filtering -- Added missing modules [RH:966888] - -* Sat Aug 03 2013 Fedora Release Engineering - 0.7.2-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - -* Sat Jun 15 2013 Matthew Miller - 0.7.2-3 -- switch ec2-user to "fedora" -- see bugzilla #971439. To use another - name, use #cloud-config option "users:" in userdata in cloud metadata - service -- add that user to systemd-journal group - -* Fri May 17 2013 Steven Hardy - 0.7.2 -- Update to the 0.7.2 release - -* Thu May 02 2013 Steven Hardy - 0.7.2-0.1.bzr809 -- Rebased against upstream rev 809, fixes several F18 related issues -- Added dependency on python-requests - -* Sat Apr 6 2013 Orion Poplawski - 0.7.1-4 -- Don't ship tests - -* Wed Feb 13 2013 Fedora Release Engineering - 0.7.1-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild - -* Thu Dec 13 2012 Garrett Holmstrom - 0.7.1-2 -- Added default_user to cloud.cfg (this is required for ssh keys to work) - -* Wed Nov 21 2012 Garrett Holmstrom - 0.7.1-1 -- Rebased against version 0.7.1 -- Fixed broken sudoers file generation -- Fixed "resize_root: noblock" [LP:1080985] - -* Tue Oct 9 2012 Garrett Holmstrom - 0.7.0-1 -- Rebased against version 0.7.0 -- Fixed / filesystem resizing - -* Sat Sep 22 2012 Garrett Holmstrom - 0.7.0-0.3.bzr659 -- Added dmidecode dependency for DataSourceAltCloud - -* Sat Sep 22 2012 Garrett Holmstrom - 0.7.0-0.2.bzr659 -- Rebased against upstream rev 659 -- Fixed hostname persistence -- Fixed ssh key printing -- Fixed sudoers file permissions - -* Mon Sep 17 2012 Garrett Holmstrom - 0.7.0-0.1.bzr650 -- Rebased against upstream rev 650 -- Added support for useradd --selinux-user - -* Thu Sep 13 2012 Garrett Holmstrom - 0.6.3-0.5.bzr532 -- Use a FQDN (instance-data.) for instance data URL fallback [RH:850916 LP:1040200] -- Shut off systemd timeouts [RH:836269] -- Send output to the console [RH:854654] - -* Wed Jul 18 2012 Fedora Release Engineering - 0.6.3-0.4.bzr532 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild - -* Wed Jun 27 2012 Pádraig Brady - 0.6.3-0.3.bzr532 -- Add support for installing yum packages - -* Sat Mar 31 2012 Andy Grimm - 0.6.3-0.2.bzr532 -- Fixed incorrect interpretation of relative path for - AuthorizedKeysFile (BZ #735521) - -* Mon Mar 5 2012 Garrett Holmstrom - 0.6.3-0.1.bzr532 -- Rebased against upstream rev 532 -- Fixed runparts() incompatibility with Fedora - -* Thu Jan 12 2012 Fedora Release Engineering - 0.6.2-0.8.bzr457 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - -* Wed Oct 5 2011 Garrett Holmstrom - 0.6.2-0.7.bzr457 -- Disabled SSH key-deleting on startup - -* Wed Sep 28 2011 Garrett Holmstrom - 0.6.2-0.6.bzr457 -- Consolidated selinux file context patches -- Fixed cloud-init.service dependencies -- Updated sshkeytypes patch -- Dealt with differences from Ubuntu's sshd - -* Sat Sep 24 2011 Garrett Holmstrom - 0.6.2-0.5.bzr457 -- Rebased against upstream rev 457 -- Added missing dependencies - -* Fri Sep 23 2011 Garrett Holmstrom - 0.6.2-0.4.bzr450 -- Added more macros to the spec file - -* Fri Sep 23 2011 Garrett Holmstrom - 0.6.2-0.3.bzr450 -- Fixed logfile permission checking -- Fixed SSH key generation -- Fixed a bad method call in FQDN-guessing [LP:857891] -- Updated localefile patch -- Disabled the grub_dpkg module -- Fixed failures due to empty script dirs [LP:857926] - -* Fri Sep 23 2011 Garrett Holmstrom - 0.6.2-0.2.bzr450 -- Updated tzsysconfig patch - -* Wed Sep 21 2011 Garrett Holmstrom - 0.6.2-0.1.bzr450 -- Initial packaging diff --git a/sources b/sources index b2f8ee3..2de1fd1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (cloud-init-20.4.tar.gz) = da2fa4673b253468380c4472795fd449809c8ac84d8f13ec1472b9b7e7d54e187ae06e5a81a36774793b05f4e1212dca57bc19aa8955b4c7fa7183cb100bfbb9 +SHA512 (cloud-init-21.1.tar.gz) = 893b1eacc343a0aad61e308819163e99cab93c6a15b47d30d0a7fb2aced03d6188cf69062117876009ebccf69ba1bd1e3145d7fd2988b5794e736c91196bea1d