Merge ~rjschwei/cloud-init:sysvinitSUSE into cloud-init:master

Proposed by Robert Schweikert
Status: Merged
Merged at revision: 243ec59fb62a8710430f9ba1e2490ee964c1abc0
Proposed branch: ~rjschwei/cloud-init:sysvinitSUSE
Merge into: cloud-init:master
Diff against target: 497 lines (+455/-0)
5 files modified
setup.py (+2/-0)
sysvinit/suse/cloud-config (+113/-0)
sysvinit/suse/cloud-final (+113/-0)
sysvinit/suse/cloud-init (+114/-0)
sysvinit/suse/cloud-init-local (+113/-0)
Reviewer Review Type Date Requested Status
Scott Moser Needs Fixing
Review via email: mp+331142@code.launchpad.net

Description of the change

Integrate sys-v-init support for SUSE LP#1718649

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

this looks fine, but i'd like to drop the extended GPL header content either entirely (the systemd and upstart units do not have any license info) or at least replace it with the simple:

  # This file is part of cloud-init. See LICENSE file for license information.

if you want i'm willing to keep Author and Copyright in place:

  # Copyright (C) 2012 Yahoo! Inc.
  # Copyright (C) 2013 SUSE LLC
  #
  # Author: Joshua Harlow <email address hidden>
  # Author: Robert Schweikert <email address hidden>
  #
  # This file is part of cloud-init. See LICENSE file for license information.

But I'd prefer the first option.

review: Needs Fixing
Revision history for this message
Robert Schweikert (rjschwei) wrote :

OK, fixed with cd6cc9b

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/setup.py b/setup.py
index 9199317..bf697d7 100755
--- a/setup.py
+++ b/setup.py
@@ -121,6 +121,7 @@ INITSYS_FILES = {
121 'sysvinit_freebsd': [f for f in glob('sysvinit/freebsd/*') if is_f(f)],121 'sysvinit_freebsd': [f for f in glob('sysvinit/freebsd/*') if is_f(f)],
122 'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)],122 'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)],
123 'sysvinit_openrc': [f for f in glob('sysvinit/gentoo/*') if is_f(f)],123 'sysvinit_openrc': [f for f in glob('sysvinit/gentoo/*') if is_f(f)],
124 'sysvinit_suse': [f for f in glob('sysvinit/suse/*') if is_f(f)],
124 'systemd': [render_tmpl(f)125 'systemd': [render_tmpl(f)
125 for f in (glob('systemd/*.tmpl') +126 for f in (glob('systemd/*.tmpl') +
126 glob('systemd/*.service') +127 glob('systemd/*.service') +
@@ -133,6 +134,7 @@ INITSYS_ROOTS = {
133 'sysvinit_freebsd': 'usr/local/etc/rc.d',134 'sysvinit_freebsd': 'usr/local/etc/rc.d',
134 'sysvinit_deb': 'etc/init.d',135 'sysvinit_deb': 'etc/init.d',
135 'sysvinit_openrc': 'etc/init.d',136 'sysvinit_openrc': 'etc/init.d',
137 'sysvinit_suse': 'etc/init.d',
136 'systemd': pkg_config_read('systemd', 'systemdsystemunitdir'),138 'systemd': pkg_config_read('systemd', 'systemdsystemunitdir'),
137 'systemd.generators': pkg_config_read('systemd',139 'systemd.generators': pkg_config_read('systemd',
138 'systemdsystemgeneratordir'),140 'systemdsystemgeneratordir'),
diff --git a/sysvinit/suse/cloud-config b/sysvinit/suse/cloud-config
139new file mode 100644141new file mode 100644
index 0000000..8c3abbb
--- /dev/null
+++ b/sysvinit/suse/cloud-config
@@ -0,0 +1,113 @@
1#!/bin/sh
2
3#
4# Copyright (C) 2017 SUSE LLC
5#
6# This file is part of cloud-init. See LICENSE file for license information.
7
8# See: http://wiki.debian.org/LSBInitScripts
9# See: http://tiny.cc/czvbgw
10# See: http://www.novell.com/coolsolutions/feature/15380.html
11# Also based on dhcpd in RHEL (for comparison)
12
13### BEGIN INIT INFO
14# Provides: cloud-config
15# Required-Start: cloud-init cloud-init-local
16# Should-Start: $time
17# Required-Stop: $null
18# Should-Stop: $null
19# Default-Start: 2 3 5
20# Default-Stop: 0 1 6
21# Short-Description: The config cloud-init job
22# Description: Start cloud-init and runs the config phase
23# and any associated config modules as desired.
24### END INIT INFO
25
26# Return values acc. to LSB for all commands but status:
27# 0 - success
28# 1 - generic or unspecified error
29# 2 - invalid or excess argument(s)
30# 3 - unimplemented feature (e.g. "reload")
31# 4 - user had insufficient privileges
32# 5 - program is not installed
33# 6 - program is not configured
34# 7 - program is not running
35# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
36#
37# Note that starting an already running service, stopping
38# or restarting a not-running service as well as the restart
39# with force-reload (in case signaling is not supported) are
40# considered a success.
41
42RETVAL=0
43
44prog="cloud-init"
45cloud_init="/usr/bin/cloud-init"
46conf="/etc/cloud/cloud.cfg"
47
48# If there exist sysconfig/default variable override files use it...
49[ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init
50[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init
51
52. /etc/rc.status
53rc_reset
54
55start() {
56 [ -x $cloud_init ] || return 5
57 [ -f $conf ] || return 6
58
59 echo -n $"Starting $prog: "
60 $cloud_init $CLOUDINITARGS modules --mode config
61 RETVAL=$?
62 return $RETVAL
63}
64
65stop() {
66 echo -n $"Shutting down $prog: "
67 # No-op
68 RETVAL=7
69 return $RETVAL
70}
71
72case "$1" in
73 start)
74 start
75 RETVAL=$?
76 ;;
77 stop)
78 stop
79 RETVAL=$?
80 ;;
81 restart|try-restart|condrestart)
82 ## Stop the service and regardless of whether it was
83 ## running or not, start it again.
84 #
85 ## Note: try-restart is now part of LSB (as of 1.9).
86 ## RH has a similar command named condrestart.
87 start
88 RETVAL=$?
89 ;;
90 reload|force-reload)
91 # It does not support reload
92 RETVAL=3
93 ;;
94 status)
95 echo -n $"Checking for service $prog:"
96 # Return value is slightly different for the status command:
97 # 0 - service up and running
98 # 1 - service dead, but /var/run/ pid file exists
99 # 2 - service dead, but /var/lock/ lock file exists
100 # 3 - service not running (unused)
101 # 4 - service status unknown :-(
102 # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
103 RETVAL=3
104 ;;
105 *)
106 echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}"
107 RETVAL=3
108 ;;
109esac
110
111_rc_status=$RETVAL
112rc_status -v
113rc_exit
diff --git a/sysvinit/suse/cloud-final b/sysvinit/suse/cloud-final
0new file mode 100644114new file mode 100644
index 0000000..714a066
--- /dev/null
+++ b/sysvinit/suse/cloud-final
@@ -0,0 +1,113 @@
1#!/bin/sh
2
3#
4# Copyright (C) 2017 SUSE LLC
5#
6# This file is part of cloud-init. See LICENSE file for license information.
7
8# See: http://wiki.debian.org/LSBInitScripts
9# See: http://tiny.cc/czvbgw
10# See: http://www.novell.com/coolsolutions/feature/15380.html
11# Also based on dhcpd in RHEL (for comparison)
12
13### BEGIN INIT INFO
14# Provides: cloud-final
15# Required-Start: cloud-config
16# Should-Start: $time
17# Required-Stop: $null
18# Should-Stop: $null
19# Default-Start: 2 3 5
20# Default-Stop: 0 1 6
21# Short-Description: The final cloud-init job
22# Description: Start cloud-init and runs the final phase
23# and any associated final modules as desired.
24### END INIT INFO
25
26# Return values acc. to LSB for all commands but status:
27# 0 - success
28# 1 - generic or unspecified error
29# 2 - invalid or excess argument(s)
30# 3 - unimplemented feature (e.g. "reload")
31# 4 - user had insufficient privileges
32# 5 - program is not installed
33# 6 - program is not configured
34# 7 - program is not running
35# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
36#
37# Note that starting an already running service, stopping
38# or restarting a not-running service as well as the restart
39# with force-reload (in case signaling is not supported) are
40# considered a success.
41
42RETVAL=0
43
44prog="cloud-init"
45cloud_init="/usr/bin/cloud-init"
46conf="/etc/cloud/cloud.cfg"
47
48# If there exist sysconfig/default variable override files use it...
49[ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init
50[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init
51
52. /etc/rc.status
53rc_reset
54
55start() {
56 [ -x $cloud_init ] || return 5
57 [ -f $conf ] || return 6
58
59 echo -n $"Starting $prog: "
60 $cloud_init $CLOUDINITARGS modules --mode final
61 RETVAL=$?
62 return $RETVAL
63}
64
65stop() {
66 echo -n $"Shutting down $prog: "
67 # No-op
68 RETVAL=7
69 return $RETVAL
70}
71
72case "$1" in
73 start)
74 start
75 RETVAL=$?
76 ;;
77 stop)
78 stop
79 RETVAL=$?
80 ;;
81 restart|try-restart|condrestart)
82 ## Stop the service and regardless of whether it was
83 ## running or not, start it again.
84 #
85 ## Note: try-restart is now part of LSB (as of 1.9).
86 ## RH has a similar command named condrestart.
87 start
88 RETVAL=$?
89 ;;
90 reload|force-reload)
91 # It does not support reload
92 RETVAL=3
93 ;;
94 status)
95 echo -n $"Checking for service $prog:"
96 # Return value is slightly different for the status command:
97 # 0 - service up and running
98 # 1 - service dead, but /var/run/ pid file exists
99 # 2 - service dead, but /var/lock/ lock file exists
100 # 3 - service not running (unused)
101 # 4 - service status unknown :-(
102 # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
103 RETVAL=3
104 ;;
105 *)
106 echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}"
107 RETVAL=3
108 ;;
109esac
110
111_rc_status=$RETVAL
112rc_status -v
113rc_exit
diff --git a/sysvinit/suse/cloud-init b/sysvinit/suse/cloud-init
0new file mode 100644114new file mode 100644
index 0000000..7126753
--- /dev/null
+++ b/sysvinit/suse/cloud-init
@@ -0,0 +1,114 @@
1#!/bin/sh
2
3#
4# Copyright (C) 2017 SUSE LLC
5#
6# This file is part of cloud-init. See LICENSE file for license information.
7
8# See: http://wiki.debian.org/LSBInitScripts
9# See: http://tiny.cc/czvbgw
10# See: http://www.novell.com/coolsolutions/feature/15380.html
11# Also based on dhcpd in RHEL (for comparison)
12
13### BEGIN INIT INFO
14# Provides: cloud-init
15# Required-Start: $local_fs $network $named $remote_fs cloud-init-local
16# Should-Start: $time
17# Required-Stop: $null
18# Should-Stop: $null
19# Default-Start: 2 3 5
20# Default-Stop: 0 1 6
21# Short-Description: The initial cloud-init job (net and fs contingent)
22# Description: Start cloud-init and runs the initialization phase
23# and any associated initial modules as desired.
24### END INIT INFO
25
26# Return values acc. to LSB for all commands but status:
27# 0 - success
28# 1 - generic or unspecified error
29# 2 - invalid or excess argument(s)
30# 3 - unimplemented feature (e.g. "reload")
31# 4 - user had insufficient privileges
32# 5 - program is not installed
33# 6 - program is not configured
34# 7 - program is not running
35# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
36#
37# Note that starting an already running service, stopping
38# or restarting a not-running service as well as the restart
39# with force-reload (in case signaling is not supported) are
40# considered a success.
41
42RETVAL=0
43
44prog="cloud-init"
45cloud_init="/usr/bin/cloud-init"
46conf="/etc/cloud/cloud.cfg"
47
48# If there exist sysconfig/default variable override files use it...
49[ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init
50[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init
51
52. /etc/rc.status
53rc_reset
54
55start() {
56 [ -x $cloud_init ] || return 5
57 [ -f $conf ] || return 6
58
59 echo -n $"Starting $prog: "
60 $cloud_init $CLOUDINITARGS init
61 RETVAL=$?
62 return $RETVAL
63}
64
65stop() {
66 echo -n $"Shutting down $prog: "
67 # No-op
68 RETVAL=7
69 return $RETVAL
70}
71
72case "$1" in
73 start)
74 start
75 RETVAL=$?
76 ;;
77 stop)
78 stop
79 RETVAL=$?
80 ;;
81 restart|try-restart|condrestart)
82 ## Stop the service and regardless of whether it was
83 ## running or not, start it again.
84 #
85 ## Note: try-restart is now part of LSB (as of 1.9).
86 ## RH has a similar command named condrestart.
87 start
88 RETVAL=$?
89 ;;
90 reload|force-reload)
91 # It does not support reload
92 RETVAL=3
93 ;;
94 status)
95 echo -n $"Checking for service $prog:"
96 RETVAL=3
97 [ -e /root/.ssh/authorized_keys ] && RETVAL=0
98 # Return value is slightly different for the status command:
99 # 0 - service up and running
100 # 1 - service dead, but /var/run/ pid file exists
101 # 2 - service dead, but /var/lock/ lock file exists
102 # 3 - service not running (unused)
103 # 4 - service status unknown :-(
104 # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
105 ;;
106 *)
107 echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}"
108 RETVAL=3
109 ;;
110esac
111
112_rc_status=$RETVAL
113rc_status -v
114rc_exit
diff --git a/sysvinit/suse/cloud-init-local b/sysvinit/suse/cloud-init-local
0new file mode 100644115new file mode 100644
index 0000000..fd3980e
--- /dev/null
+++ b/sysvinit/suse/cloud-init-local
@@ -0,0 +1,113 @@
1#!/bin/sh
2
3#
4# Copyright (C) 2017 SUSE LLC
5#
6# This file is part of cloud-init. See LICENSE file for license information.
7
8# See: http://wiki.debian.org/LSBInitScripts
9# See: http://tiny.cc/czvbgw
10# See: http://www.novell.com/coolsolutions/feature/15380.html
11# Also based on dhcpd in RHEL (for comparison)
12
13### BEGIN INIT INFO
14# Provides: cloud-init-local
15# Required-Start: $local_fs $remote_fs
16# Should-Start: $time
17# Required-Stop: $null
18# Should-Stop: $null
19# Default-Start: 2 3 5
20# Default-Stop: 0 1 6
21# Short-Description: The initial cloud-init job (local fs contingent)
22# Description: Start cloud-init and runs the initialization phases
23# and any associated initial modules as desired.
24### END INIT INFO
25
26# Return values acc. to LSB for all commands but status:
27# 0 - success
28# 1 - generic or unspecified error
29# 2 - invalid or excess argument(s)
30# 3 - unimplemented feature (e.g. "reload")
31# 4 - user had insufficient privileges
32# 5 - program is not installed
33# 6 - program is not configured
34# 7 - program is not running
35# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
36#
37# Note that starting an already running service, stopping
38# or restarting a not-running service as well as the restart
39# with force-reload (in case signaling is not supported) are
40# considered a success.
41
42RETVAL=0
43
44prog="cloud-init"
45cloud_init="/usr/bin/cloud-init"
46conf="/etc/cloud/cloud.cfg"
47
48# If there exist sysconfig/default variable override files use it...
49[ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init
50[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init
51
52. /etc/rc.status
53rc_reset
54
55start() {
56 [ -x $cloud_init ] || return 5
57 [ -f $conf ] || return 6
58
59 echo -n $"Starting $prog: "
60 $cloud_init $CLOUDINITARGS init --local
61 RETVAL=$?
62 return $RETVAL
63}
64
65stop() {
66 echo -n $"Shutting down $prog: "
67 # No-op
68 RETVAL=7
69 return $RETVAL
70}
71
72case "$1" in
73 start)
74 start
75 RETVAL=$?
76 ;;
77 stop)
78 stop
79 RETVAL=$?
80 ;;
81 restart|try-restart|condrestart)
82 ## Stop the service and regardless of whether it was
83 ## running or not, start it again.
84 #
85 ## Note: try-restart is now part of LSB (as of 1.9).
86 ## RH has a similar command named condrestart.
87 start
88 RETVAL=$?
89 ;;
90 reload|force-reload)
91 # It does not support reload
92 RETVAL=3
93 ;;
94 status)
95 echo -n $"Checking for service $prog:"
96 # Return value is slightly different for the status command:
97 # 0 - service up and running
98 # 1 - service dead, but /var/run/ pid file exists
99 # 2 - service dead, but /var/lock/ lock file exists
100 # 3 - service not running (unused)
101 # 4 - service status unknown :-(
102 # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
103 RETVAL=3
104 ;;
105 *)
106 echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}"
107 RETVAL=3
108 ;;
109esac
110
111_rc_status=$RETVAL
112rc_status -v
113rc_exit

Subscribers

People subscribed via source and target branches