Initial build (0.6.2-0.1.bzr450)
This commit is contained in:
parent
bb72dd0c24
commit
4907847669
1
.gitignore
vendored
1
.gitignore
vendored
@ -0,0 +1 @@
|
||||
/cloud-init-0.6.2-bzr450.tar.gz
|
136
cloud-init-0.6.2-botobundle.patch
Normal file
136
cloud-init-0.6.2-botobundle.patch
Normal file
@ -0,0 +1,136 @@
|
||||
Index: cloud-init/cloudinit/DataSourceEc2.py
|
||||
===================================================================
|
||||
--- cloud-init.orig/cloudinit/DataSourceEc2.py
|
||||
+++ cloud-init/cloudinit/DataSourceEc2.py
|
||||
@@ -24,7 +24,7 @@ import socket
|
||||
import urllib2
|
||||
import time
|
||||
import sys
|
||||
-import boto_utils
|
||||
+import boto.utils
|
||||
import os.path
|
||||
import errno
|
||||
import urlparse
|
||||
@@ -48,8 +48,8 @@ class DataSourceEc2(DataSource.DataSourc
|
||||
try:
|
||||
if not self.wait_for_metadata_service():
|
||||
return False
|
||||
- self.userdata_raw = boto_utils.get_instance_userdata(self.api_ver, None, self.metadata_address)
|
||||
- self.metadata = boto_utils.get_instance_metadata(self.api_ver, self.metadata_address)
|
||||
+ self.userdata_raw = boto.utils.get_instance_userdata(self.api_ver, None, self.metadata_address)
|
||||
+ self.metadata = boto.utils.get_instance_metadata(self.api_ver, self.metadata_address)
|
||||
return True
|
||||
except Exception as e:
|
||||
print e
|
||||
Index: cloud-init/cloudinit/boto_utils.py
|
||||
===================================================================
|
||||
--- cloud-init.orig/cloudinit/boto_utils.py
|
||||
+++ /dev/null
|
||||
@@ -1,107 +0,0 @@
|
||||
-# The contents of this file are taken from boto 1.9b's boto/utils.py
|
||||
-#
|
||||
-# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
|
||||
-#
|
||||
-# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
-# copy of this software and associated documentation files (the
|
||||
-# "Software"), to deal in the Software without restriction, including
|
||||
-# without limitation the rights to use, copy, modify, merge, publish, dis-
|
||||
-# tribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
-# persons to whom the Software is furnished to do so, subject to the fol-
|
||||
-# lowing conditions:
|
||||
-#
|
||||
-# The above copyright notice and this permission notice shall be included
|
||||
-# in all copies or substantial portions of the Software.
|
||||
-#
|
||||
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
|
||||
-# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
-# IN THE SOFTWARE.
|
||||
-
|
||||
-#
|
||||
-# Parts of this code were copied or derived from sample code supplied by AWS.
|
||||
-# The following notice applies to that code.
|
||||
-#
|
||||
-# This software code is made available "AS IS" without warranties of any
|
||||
-# kind. You may copy, display, modify and redistribute the software
|
||||
-# code either by itself or as incorporated into your code; provided that
|
||||
-# you do not remove any proprietary notices. Your use of this software
|
||||
-# code is at your own risk and you waive any claim against Amazon
|
||||
-# Digital Services, Inc. or its affiliates with respect to your use of
|
||||
-# this software code. (c) 2006 Amazon Digital Services, Inc. or its
|
||||
-# affiliates.
|
||||
-import urllib2
|
||||
-import sys
|
||||
-import time
|
||||
-
|
||||
-def retry_url(url, retry_on_404=True):
|
||||
- for i in range(0, 10):
|
||||
- try:
|
||||
- req = urllib2.Request(url)
|
||||
- resp = urllib2.urlopen(req)
|
||||
- return resp.read()
|
||||
- except urllib2.HTTPError as e:
|
||||
- # in 2.6 you use getcode(), in 2.5 and earlier you use code
|
||||
- if hasattr(e, 'getcode'):
|
||||
- code = e.getcode()
|
||||
- else:
|
||||
- code = e.code
|
||||
- if code == 404 and not retry_on_404:
|
||||
- return ''
|
||||
- except:
|
||||
- pass
|
||||
- #boto.log.exception('Caught exception reading instance data')
|
||||
- sys.stderr.write('Caught exception reading instance data: %s\n' % url)
|
||||
- time.sleep(2**i)
|
||||
- #boto.log.error('Unable to read instance data, giving up')
|
||||
- sys.stderr.write('Caught exception reading instance data, giving up\n')
|
||||
- return ''
|
||||
-
|
||||
-def get_instance_metadata(version='latest',url='http://169.254.169.254'):
|
||||
- """
|
||||
- Returns the instance metadata as a nested Python dictionary.
|
||||
- Simple values (e.g. local_hostname, hostname, etc.) will be
|
||||
- stored as string values. Values such as ancestor-ami-ids will
|
||||
- be stored in the dict as a list of string values. More complex
|
||||
- fields such as public-keys and will be stored as nested dicts.
|
||||
- """
|
||||
- url = '%s/%s/meta-data/' % (url,version)
|
||||
- return _get_instance_metadata(url)
|
||||
-
|
||||
-def get_instance_userdata(version='latest', sep=None,url='http://169.254.169.254'):
|
||||
- url = '%s/%s/user-data' % (url,version)
|
||||
- user_data = retry_url(url, retry_on_404=False)
|
||||
- if user_data:
|
||||
- if sep:
|
||||
- l = user_data.split(sep)
|
||||
- user_data = {}
|
||||
- for nvpair in l:
|
||||
- t = nvpair.split('=')
|
||||
- user_data[t[0].strip()] = t[1].strip()
|
||||
- return user_data
|
||||
-
|
||||
-
|
||||
-def _get_instance_metadata(url):
|
||||
- d = {}
|
||||
- data = retry_url(url)
|
||||
- if data:
|
||||
- fields = data.split('\n')
|
||||
- for field in fields:
|
||||
- if field.endswith('/'):
|
||||
- d[field[0:-1]] = _get_instance_metadata(url + field)
|
||||
- else:
|
||||
- p = field.find('=')
|
||||
- if p > 0:
|
||||
- key = field[p+1:]
|
||||
- resource = field[0:p] + '/openssh-key'
|
||||
- else:
|
||||
- key = resource = field
|
||||
- val = retry_url(url + resource)
|
||||
- p = val.find('\n')
|
||||
- if p > 0:
|
||||
- val = val.split('\n')
|
||||
- d[key] = val
|
||||
- return d
|
41
cloud-init-0.6.2-fedora.patch
Normal file
41
cloud-init-0.6.2-fedora.patch
Normal file
@ -0,0 +1,41 @@
|
||||
Index: cloud-init/setup.py
|
||||
===================================================================
|
||||
--- cloud-init.orig/setup.py
|
||||
+++ cloud-init/setup.py
|
||||
@@ -40,9 +40,8 @@ setup(name='cloud-init',
|
||||
data_files=[('/etc/cloud', glob('config/*.cfg')),
|
||||
('/etc/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')),
|
||||
('/etc/cloud/templates', glob('templates/*')),
|
||||
- ('/etc/init', glob('upstart/*.conf')),
|
||||
('/usr/share/cloud-init', []),
|
||||
- ('/usr/lib/cloud-init',
|
||||
+ ('/usr/libexec/cloud-init',
|
||||
['tools/uncloud-init', 'tools/write-ssh-key-fingerprints']),
|
||||
('/usr/share/doc/cloud-init', filter(is_f,glob('doc/*'))),
|
||||
('/usr/share/doc/cloud-init/examples', filter(is_f,glob('doc/examples/*'))),
|
||||
Index: cloud-init/cloudinit/CloudConfig/cc_keys_to_console.py
|
||||
===================================================================
|
||||
--- cloud-init.orig/cloudinit/CloudConfig/cc_keys_to_console.py
|
||||
+++ cloud-init/cloudinit/CloudConfig/cc_keys_to_console.py
|
||||
@@ -21,7 +21,7 @@ import subprocess
|
||||
frequency = per_instance
|
||||
|
||||
def handle(name,cfg,cloud,log,args):
|
||||
- write_ssh_prog='/usr/lib/cloud-init/write-ssh-key-fingerprints'
|
||||
+ write_ssh_prog='/usr/libexec/cloud-init/write-ssh-key-fingerprints'
|
||||
try:
|
||||
confp = open('/dev/console',"wb")
|
||||
subprocess.call(write_ssh_prog,stdout=confp)
|
||||
Index: cloud-init/cloudinit/CloudConfig/cc_ssh.py
|
||||
===================================================================
|
||||
--- cloud-init.orig/cloudinit/CloudConfig/cc_ssh.py
|
||||
+++ cloud-init/cloudinit/CloudConfig/cc_ssh.py
|
||||
@@ -85,7 +85,7 @@ def handle(name,cfg,cloud,log,args):
|
||||
send_ssh_keys_to_console()
|
||||
|
||||
def send_ssh_keys_to_console():
|
||||
- subprocess.call(('/usr/lib/cloud-init/write-ssh-key-fingerprints',))
|
||||
+ subprocess.call(('/usr/libexec/cloud-init/write-ssh-key-fingerprints',))
|
||||
|
||||
def apply_credentials(keys, user, disable_root, disable_root_opts=DISABLE_ROOT_OPTS, log=global_log):
|
||||
keys = set(keys)
|
37
cloud-init-0.6.2-localefile.patch
Normal file
37
cloud-init-0.6.2-localefile.patch
Normal file
@ -0,0 +1,37 @@
|
||||
Index: cloud-init/cloudinit/CloudConfig/cc_locale.py
|
||||
===================================================================
|
||||
--- cloud-init.orig/cloudinit/CloudConfig/cc_locale.py
|
||||
+++ cloud-init/cloudinit/CloudConfig/cc_locale.py
|
||||
@@ -16,15 +16,17 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import cloudinit.util as util
|
||||
+import os.path
|
||||
import subprocess
|
||||
import traceback
|
||||
|
||||
-def apply_locale(locale):
|
||||
- subprocess.Popen(['locale-gen', locale]).communicate()
|
||||
- subprocess.Popen(['update-locale', locale]).communicate()
|
||||
+def apply_locale(locale, cfgfile):
|
||||
+ if os.path.exists('/usr/sbin/locale-gen'):
|
||||
+ subprocess.Popen(['locale-gen', locale]).communicate()
|
||||
+ if os.path.exists('/usr/sbin/update-locale'):
|
||||
+ subprocess.Popen(['update-locale', locale]).communicate()
|
||||
|
||||
- util.render_to_file('default-locale', '/etc/default/locale', \
|
||||
- { 'locale' : locale })
|
||||
+ util.render_to_file('default-locale', cfgfile, { 'locale' : locale })
|
||||
|
||||
def handle(name,cfg,cloud,log,args):
|
||||
if len(args) != 0:
|
||||
@@ -32,6 +34,9 @@ def handle(name,cfg,cloud,log,args):
|
||||
else:
|
||||
locale = util.get_cfg_option_str(cfg,"locale",cloud.get_locale())
|
||||
|
||||
+ locale_cfgfile = util.get_cfg_option_str(cfg, "locale_configfile",
|
||||
+ "/etc/default/locale")
|
||||
+
|
||||
if not locale: return
|
||||
|
||||
log.debug("setting locale to %s" % locale)
|
35
cloud-init-0.6.2-puppetcontext.patch
Normal file
35
cloud-init-0.6.2-puppetcontext.patch
Normal file
@ -0,0 +1,35 @@
|
||||
Index: cloud-init/cloudinit/CloudConfig/cc_puppet.py
|
||||
===================================================================
|
||||
--- cloud-init.orig/cloudinit/CloudConfig/cc_puppet.py
|
||||
+++ cloud-init/cloudinit/CloudConfig/cc_puppet.py
|
||||
@@ -23,6 +23,12 @@ import StringIO
|
||||
import ConfigParser
|
||||
import cloudinit.CloudConfig as cc
|
||||
|
||||
+try:
|
||||
+ import selinux
|
||||
+ HAVE_LIBSELINUX = True
|
||||
+except ImportError:
|
||||
+ HAVE_LIBSELINUX = False
|
||||
+
|
||||
def handle(name,cfg,cloud,log,args):
|
||||
# If there isn't a puppet key in the configuration don't do anything
|
||||
if not cfg.has_key('puppet'): return
|
||||
@@ -58,6 +64,8 @@ def handle(name,cfg,cloud,log,args):
|
||||
ca_fh.close()
|
||||
os.chown('/var/lib/puppet/ssl/certs/ca.pem',
|
||||
pwd.getpwnam('puppet').pw_uid, 0)
|
||||
+ if HAVE_LIBSELINUX and selinux.is_selinux_enabled():
|
||||
+ selinux.restorecon('/var/lib/puppet', recursive=True)
|
||||
else:
|
||||
#puppet_conf_fh.write("\n[%s]\n" % (cfg_name))
|
||||
# If puppet.conf already has this section we don't want to write it again
|
||||
@@ -81,6 +89,8 @@ def handle(name,cfg,cloud,log,args):
|
||||
os.rename('/etc/puppet/puppet.conf','/etc/puppet/puppet.conf.old')
|
||||
with open('/etc/puppet/puppet.conf', 'wb') as configfile:
|
||||
puppet_config.write(configfile)
|
||||
+ if HAVE_LIBSELINUX and selinux.is_selinux_enabled():
|
||||
+ selinux.restorecon('/etc/puppet/puppet.conf')
|
||||
# Set puppet default file to automatically start
|
||||
subprocess.check_call(['sed', '-i',
|
||||
'-e', 's/^START=.*/START=yes/',
|
32
cloud-init-0.6.2-puppetenable.patch
Normal file
32
cloud-init-0.6.2-puppetenable.patch
Normal file
@ -0,0 +1,32 @@
|
||||
Index: cloud-init/cloudinit/CloudConfig/cc_puppet.py
|
||||
===================================================================
|
||||
--- cloud-init.orig/cloudinit/CloudConfig/cc_puppet.py
|
||||
+++ cloud-init/cloudinit/CloudConfig/cc_puppet.py
|
||||
@@ -16,6 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import os
|
||||
+import os.path
|
||||
import pwd
|
||||
import socket
|
||||
import subprocess
|
||||
@@ -91,10 +92,15 @@ def handle(name,cfg,cloud,log,args):
|
||||
puppet_config.write(configfile)
|
||||
if HAVE_LIBSELINUX and selinux.is_selinux_enabled():
|
||||
selinux.restorecon('/etc/puppet/puppet.conf')
|
||||
- # Set puppet default file to automatically start
|
||||
- subprocess.check_call(['sed', '-i',
|
||||
- '-e', 's/^START=.*/START=yes/',
|
||||
- '/etc/default/puppet'])
|
||||
+ # Set puppet to automatically start
|
||||
+ if os.path.exists('/etc/default/puppet'):
|
||||
+ subprocess.check_call(['sed', '-i',
|
||||
+ '-e', 's/^START=.*/START=yes/',
|
||||
+ '/etc/default/puppet'])
|
||||
+ elif os.path.exists('/bin/systemctl'):
|
||||
+ subprocess.check_call(['/bin/systemctl', 'enable', 'puppet.service'])
|
||||
+ elif os.path.exists('/sbin/chkconfig'):
|
||||
+ subprocess.check_call(['/sbin/chkconfig', 'puppet', 'on'])
|
||||
# Start puppetd
|
||||
subprocess.check_call(['service', 'puppet', 'start'])
|
||||
|
26
cloud-init-0.6.2-sshcontext.patch
Normal file
26
cloud-init-0.6.2-sshcontext.patch
Normal file
@ -0,0 +1,26 @@
|
||||
Index: cloud-init/cloudinit/SshUtil.py
|
||||
===================================================================
|
||||
--- cloud-init.orig/cloudinit/SshUtil.py
|
||||
+++ cloud-init/cloudinit/SshUtil.py
|
||||
@@ -4,6 +4,12 @@ import os
|
||||
import os.path
|
||||
import cloudinit.util as util
|
||||
|
||||
+try:
|
||||
+ import selinux
|
||||
+ HAVE_LIBSELINUX = True
|
||||
+except ImportError:
|
||||
+ HAVE_LIBSELINUX = False
|
||||
+
|
||||
class AuthKeyEntry():
|
||||
# lines are options, keytype, base64-encoded key, comment
|
||||
# man page says the following which I did not understand:
|
||||
@@ -147,6 +153,8 @@ def setup_user_keys(keys, user, key_pref
|
||||
util.write_file(authorized_keys, content, 0600)
|
||||
|
||||
os.chown(authorized_keys, pwent.pw_uid, pwent.pw_gid)
|
||||
+ if HAVE_LIBSELINUX and selinux.is_selinux_enabled():
|
||||
+ selinux.restorecon(ssh_dir, recursive=True)
|
||||
|
||||
os.umask(saved_umask)
|
||||
|
86
cloud-init-0.6.2-systemd.patch
Normal file
86
cloud-init-0.6.2-systemd.patch
Normal file
@ -0,0 +1,86 @@
|
||||
Index: cloud-init/systemd/cloud-config.service
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ cloud-init/systemd/cloud-config.service
|
||||
@@ -0,0 +1,13 @@
|
||||
+[Unit]
|
||||
+Description=Apply the settings specified in cloud-config
|
||||
+After=network.target syslog.target cloud-config.target
|
||||
+Requires=cloud-config.target
|
||||
+Wants=network.target
|
||||
+
|
||||
+[Service]
|
||||
+Type=oneshot
|
||||
+ExecStart=/usr/bin/cloud-init-cfg all config
|
||||
+RemainAfterExit=yes
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=multi-user.target
|
||||
Index: cloud-init/systemd/cloud-config.target
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ cloud-init/systemd/cloud-config.target
|
||||
@@ -0,0 +1,10 @@
|
||||
+# 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
|
||||
+Requires=cloud-init-local.service cloud-init.service
|
||||
Index: cloud-init/systemd/cloud-final.service
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ cloud-init/systemd/cloud-final.service
|
||||
@@ -0,0 +1,13 @@
|
||||
+[Unit]
|
||||
+Description=Execute cloud user/final scripts
|
||||
+After=network.target syslog.target cloud-config.service rc-local.service
|
||||
+Requires=cloud-config.target
|
||||
+Wants=network.target
|
||||
+
|
||||
+[Service]
|
||||
+Type=oneshot
|
||||
+ExecStart=/usr/bin/cloud-init-cfg all final
|
||||
+RemainAfterExit=yes
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=multi-user.target
|
||||
Index: cloud-init/systemd/cloud-init-local.service
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ cloud-init/systemd/cloud-init-local.service
|
||||
@@ -0,0 +1,12 @@
|
||||
+[Unit]
|
||||
+Description=Initial cloud-init job (pre-networking)
|
||||
+Wants=local-fs.target
|
||||
+After=local-fs.target
|
||||
+
|
||||
+[Service]
|
||||
+Type=oneshot
|
||||
+ExecStart=/usr/bin/cloud-init start-local
|
||||
+RemainAfterExit=yes
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=multi-user.target
|
||||
Index: cloud-init/systemd/cloud-init.service
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ cloud-init/systemd/cloud-init.service
|
||||
@@ -0,0 +1,13 @@
|
||||
+[Unit]
|
||||
+Description=Initial cloud-init job (metadata service crawler)
|
||||
+After=local-fs.target network.target cloud-init-local.service
|
||||
+Requires=network.target
|
||||
+Wants=local-fs.target
|
||||
+
|
||||
+[Service]
|
||||
+Type=oneshot
|
||||
+ExecStart=/usr/bin/cloud-init start
|
||||
+RemainAfterExit=yes
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=multi-user.target
|
33
cloud-init-0.6.2-tzsysconfig.patch
Normal file
33
cloud-init-0.6.2-tzsysconfig.patch
Normal file
@ -0,0 +1,33 @@
|
||||
Index: cloud-init/cloudinit/CloudConfig/cc_timezone.py
|
||||
===================================================================
|
||||
--- cloud-init.orig/cloudinit/CloudConfig/cc_timezone.py
|
||||
+++ cloud-init/cloudinit/CloudConfig/cc_timezone.py
|
||||
@@ -38,13 +38,21 @@ def handle(name,cfg,cloud,log,args):
|
||||
log.debug("Invalid timezone %s" % tz_file)
|
||||
raise Exception("Invalid timezone %s" % tz_file)
|
||||
|
||||
- try:
|
||||
- fp=open("/etc/timezone","wb")
|
||||
- fp.write("%s\n" % timezone)
|
||||
- fp.close()
|
||||
- except:
|
||||
- log.debug("failed to write to /etc/timezone")
|
||||
- raise
|
||||
+ if os.path.exists("/etc/timezone"):
|
||||
+ try:
|
||||
+ fp=open("/etc/timezone","wb")
|
||||
+ fp.write("%s\n" % timezone)
|
||||
+ fp.close()
|
||||
+ except:
|
||||
+ log.debug("failed to write to /etc/timezone")
|
||||
+ raise
|
||||
+ elif os.path.exists("/etc/sysconfig/clock"):
|
||||
+ try:
|
||||
+ with open("/etc/sysconfig/clock", "w") as fp:
|
||||
+ fp.write('ZONE="%s"\n' % timezone)
|
||||
+ except:
|
||||
+ log.debug("failed to write to /etc/sysconfig/clock")
|
||||
+ raise
|
||||
|
||||
try:
|
||||
shutil.copy(tz_file, "/etc/localtime")
|
12
cloud-init-README.fedora
Normal file
12
cloud-init-README.fedora
Normal file
@ -0,0 +1,12 @@
|
||||
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_fy_default' option)
|
||||
- chef
|
||||
- grub_dpkg
|
||||
- mcollective
|
||||
- set_hostname ('hostname' and 'fqdn' options)
|
||||
- update_hostname
|
||||
|
||||
Future work:
|
||||
- 'hostname' and 'fqdn' support
|
||||
- 'packages' and yum support
|
37
cloud-init-fedora.cfg
Normal file
37
cloud-init-fedora.cfg
Normal file
@ -0,0 +1,37 @@
|
||||
user: ec2-user
|
||||
disable_root: 1
|
||||
ssh_pwauth: 0
|
||||
|
||||
cc_ready_cmd: ['/bin/true']
|
||||
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
|
||||
locale_configfile: /etc/sysconfig/i18n
|
||||
|
||||
cloud_init_modules:
|
||||
- bootcmd
|
||||
- resizefs
|
||||
- set_hostname
|
||||
- rsyslog
|
||||
- ssh
|
||||
|
||||
cloud_config_modules:
|
||||
- mounts
|
||||
- ssh-import-id
|
||||
- locale
|
||||
- set-passwords
|
||||
- grub-dpkg
|
||||
- timezone
|
||||
- puppet
|
||||
- disable-ec2-metadata
|
||||
- runcmd
|
||||
|
||||
cloud_final_modules:
|
||||
- rightscale_userdata
|
||||
- scripts-per-once
|
||||
- scripts-per-boot
|
||||
- scripts-per-instance
|
||||
- scripts-user
|
||||
- keys-to-console
|
||||
- phone-home
|
||||
- final-message
|
||||
|
||||
# vim:syntax=yaml
|
154
cloud-init.spec
Normal file
154
cloud-init.spec
Normal file
@ -0,0 +1,154 @@
|
||||
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||
|
||||
Name: cloud-init
|
||||
Version: 0.6.2
|
||||
Release: 0.1.bzr450%{?dist}
|
||||
Summary: EC2 instance init scripts
|
||||
|
||||
Group: System Environment/Base
|
||||
License: GPLv3
|
||||
URL: http://launchpad.net/cloud-init
|
||||
# bzr export -r 450 cloud-init-0.6.2-bzr450.tar.gz lp:cloud-init
|
||||
Source0: %{name}-%{version}-bzr450.tar.gz
|
||||
Source1: cloud-init-fedora.cfg
|
||||
Source2: cloud-init-README.fedora
|
||||
Patch0: cloud-init-0.6.2-fedora.patch
|
||||
# Unbundle boto.utils (not yet upstream)
|
||||
Patch1: cloud-init-0.6.2-botobundle.patch
|
||||
# Add systemd support (not yet upstream)
|
||||
Patch2: cloud-init-0.6.2-systemd.patch
|
||||
# Restore SSH files' selinux contexts (not yet upstream)
|
||||
Patch3: cloud-init-0.6.2-sshcontext.patch
|
||||
# Make locale file location configurable (not yet upstream)
|
||||
Patch4: cloud-init-0.6.2-localefile.patch
|
||||
# Write timezone data to /etc/sysconfig/clock (not yet upstream)
|
||||
Patch5: cloud-init-0.6.2-tzsysconfig.patch
|
||||
# Restore puppet files' selinux contexts (not yet upstream)
|
||||
Patch6: cloud-init-0.6.2-puppetcontext.patch
|
||||
# Make enabling the puppet service work on Fedora (not yet upstream)
|
||||
Patch7: cloud-init-0.6.2-puppetenable.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: python-devel
|
||||
BuildRequires: python-setuptools-devel
|
||||
BuildRequires: systemd-units
|
||||
Requires: e2fsprogs
|
||||
Requires: iproute
|
||||
Requires: libselinux-python
|
||||
Requires: net-tools
|
||||
Requires: procps
|
||||
Requires: python-boto
|
||||
Requires: python-cheetah
|
||||
Requires: python-configobj
|
||||
Requires: PyYAML
|
||||
Requires: shadow-utils
|
||||
Requires: xfsprogs
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
|
||||
%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
|
||||
ssh keys and to let the user run various scripts.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}-bzr450
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
cp -p %{SOURCE2} README.fedora
|
||||
|
||||
|
||||
%build
|
||||
%{__python} setup.py build
|
||||
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
|
||||
|
||||
for x in $RPM_BUILD_ROOT/usr/bin/*.py; do mv "$x" "${x%.py}"; done
|
||||
chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/cloudinit/SshUtil.py
|
||||
install -d $RPM_BUILD_ROOT/var/lib/cloud
|
||||
|
||||
# We supply our own config file since our software differs from Ubuntu's.
|
||||
cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/cloud/cloud.cfg
|
||||
|
||||
# /etc/rsyslog.d didn't exist by default until F15.
|
||||
# el6: https://bugzilla.redhat.com/show_bug.cgi?id=740420
|
||||
%if 0%{?fedora} > 14
|
||||
install -d $RPM_BUILD_ROOT/etc/rsyslog.d
|
||||
cp -p tools/21-cloudinit.conf $RPM_BUILD_ROOT/etc/rsyslog.d/21-cloudinit.conf
|
||||
%endif
|
||||
|
||||
# Install the systemd bits
|
||||
mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
|
||||
cp -p systemd/* $RPM_BUILD_ROOT/%{_unitdir}
|
||||
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%post
|
||||
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 || :
|
||||
fi
|
||||
|
||||
%preun
|
||||
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 || :
|
||||
# One-shot services -> no need to stop
|
||||
fi
|
||||
|
||||
%postun
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
# One-shot services -> no need to restart
|
||||
|
||||
|
||||
%files
|
||||
%doc ChangeLog LICENSE TODO README.fedora
|
||||
%config(noreplace) /etc/cloud/cloud.cfg
|
||||
%dir /etc/cloud/cloud.cfg.d
|
||||
%config(noreplace) /etc/cloud/cloud.cfg.d/*.cfg
|
||||
%doc /etc/cloud/cloud.cfg.d/README
|
||||
%dir /etc/cloud/templates
|
||||
%config(noreplace) /etc/cloud/templates/*
|
||||
%{_unitdir}/cloud-config.service
|
||||
%{_unitdir}/cloud-config.target
|
||||
%{_unitdir}/cloud-final.service
|
||||
%{_unitdir}/cloud-init-local.service
|
||||
%{_unitdir}/cloud-init.service
|
||||
%{python_sitelib}/*
|
||||
%{_libexecdir}/%{name}
|
||||
/usr/bin/cloud-init*
|
||||
%doc /usr/share/doc/%{name}
|
||||
%dir /var/lib/cloud
|
||||
|
||||
%if 0%{?fedora} > 14
|
||||
%config(noreplace) /etc/rsyslog.d/21-cloudinit.conf
|
||||
%endif
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Sep 21 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.1.bzr450
|
||||
- Initial packaging
|
Loading…
Reference in New Issue
Block a user