- add more dependencies to ensure commands used by the scripts are present

- add dynamicInitCmd.diff
  + support diffirent init systems across distribution versions for
    service restart
- add suseSetInitCmd.patch
  + properly setup the init command to support proper service restart

OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=14
This commit is contained in:
2014-06-24 19:29:50 +00:00
committed by Git OBS Bridge
parent eacce78d5d
commit 7e9476e0dc
4 changed files with 87 additions and 2 deletions

View File

@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Tue Jun 24 19:23:07 UTC 2014 - rschweikert@suse.com
- add more dependencies to ensure commands used by the scripts are present
- add dynamicInitCmd.diff
+ support diffirent init systems across distribution versions for
service restart
- add suseSetInitCmd.patch
+ properly setup the init command to support proper service restart
-------------------------------------------------------------------
Fri Jun 20 17:59:37 UTC 2014 - rschweikert@suse.com

View File

@@ -25,15 +25,25 @@ Group: System/Management
Source0: %{name}-%{version}.tar.gz
Source1: cloud.cfg.suse
Patch0: suseSysVInit.diff
# FIXME addopenSUSEBase.patch proposed for upstream merge
Patch1: addopenSUSEBase.patch
# FIXME suseIntegratedHandler.patch proposed for upstream merge
Patch2: suseIntegratedHandler.patch
Patch3: setupSUSEsysVInit.diff
# FIXME openSUSEhostsTemplate.diff proposed for upstream merge
Patch5: openSUSEhostsTemplate.diff
# FIXME dynamicInitCmd.patch proposed for upstream merge
Patch6: dynamicInitCmd.diff
# FIXME suseSetInitCmd.patch send upstream once the SUSE handlers are accepted
Patch7: suseSetInitCmd.patch
BuildRequires: fdupes
BuildRequires: filesystem
BuildRequires: python-devel
BuildRequires: python-setuptools
Requires: bash
Requires: file
Requires: growpart
Requires: openssh
Requires: python-argparse
Requires: python-boto >= 2.7
Requires: python-cheetah
@@ -46,10 +56,11 @@ Requires: python-PyYAML
Requires: python-requests
Requires: python-xml
Requires: python-yaml
Requires: sudo
Requires: util-linux
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define docdir %{_defaultdocdir}/%{name}
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%else
%if 0%{?suse_version} && 0%{?suse_version} >= 1110
BuildArch: noarch
%endif
%if 0%{?suse_version} && 0%{?suse_version} <= 1210
@@ -57,6 +68,7 @@ BuildArch: noarch
%else
%define initsys systemd
BuildRequires: systemd
Requires: systemd
%{?systemd_requires}
%if 0%{?suse_version} && 0%{?suse_version} == 1220
%define systemd_prefix /lib
@@ -64,6 +76,15 @@ BuildRequires: systemd
%define systemd_prefix /usr/lib
%endif
%endif
%if 0%{?suse_version} && 0%{?suse_version} >= 1315
Requires: wicked-service
%else
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
Requires: sysconfig
%else
Requires: sysconfig-network
%endif
%endif
%description
Cloud-init is an init script that initializes a cloud node (VM)
@@ -98,6 +119,8 @@ Unit tests for the cloud-init tools
%patch2
%patch3 -p1
%patch5
%patch6
%patch7
%if 0%{?suse_version} <= 1130
# disable ecdsa for SLE 11 (not available)

27
dynamicInitCmd.diff Normal file
View File

@@ -0,0 +1,27 @@
=== modified file 'cloudinit/config/cc_set_passwords.py'
--- cloudinit/config/cc_set_passwords.py 2014-02-06 21:38:30 +0000
+++ cloudinit/config/cc_set_passwords.py 2014-06-24 18:39:33 +0000
@@ -136,7 +136,7 @@
util.write_file(ssh_util.DEF_SSHD_CFG, "\n".join(lines))
try:
- cmd = cloud.distro.init_cmd # Default service
+ cmd = cloud.distro.get_init_cmd()
cmd.append(cloud.distro.get_option('ssh_svcname', 'ssh'))
cmd.append('restart')
if 'systemctl' in cmd: # Switch action ordering
=== modified file 'cloudinit/distros/__init__.py'
--- cloudinit/distros/__init__.py 2014-02-12 19:56:55 +0000
+++ cloudinit/distros/__init__.py 2014-06-24 18:39:33 +0000
@@ -79,6 +79,9 @@
" no file found at %s") % (tz, tz_file))
return tz_file
+ def get_init_cmd(self):
+ return self.init_cmd
+
def get_option(self, opt_name, default=None):
return self._cfg.get(opt_name, default)

25
suseSetInitCmd.patch Normal file
View File

@@ -0,0 +1,25 @@
--- cloudinit/distros/opensuse.py.orig
+++ cloudinit/distros/opensuse.py
@@ -43,6 +43,7 @@ class Distro(distros.Distro):
resolve_conf_fn = '/etc/resolv.conf'
tz_local_fn = '/etc/localtime'
systemd_locale_conf_fn = '/etc/locale.conf'
+ init_cmd = ['service']
def __init__(self, name, cfg, paths):
distros.Distro.__init__(self, name, cfg, paths)
@@ -50,9 +51,13 @@ class Distro(distros.Distro):
# calls from repeatly happening (when they
# should only happen say once per instance...)
self._runner = helpers.Runners(paths)
+ cfg['ssh_svcname'] = 'sshd'
self.osfamily = 'suse'
self.systemdDist = util.which('systemctl')
-
+ if self.systemdDist:
+ self.init_cmd = ['systemctl']
+ cfg['ssh_svcname'] = 'sshd.service'
+
def apply_locale(self, locale, out_fn=None):
if self.systemdDist:
if not out_fn: