Rebase against upstream rev 457

This commit is contained in:
Garrett Holmstrom 2011-09-24 15:44:42 -07:00
parent 7ce36c0c7d
commit 655e31633a
5 changed files with 9 additions and 161 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/cloud-init-0.6.2-bzr450.tar.gz
/cloud-init-0.6.2-bzr457.tar.gz

View File

@ -1,136 +0,0 @@
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

View File

@ -1,13 +0,0 @@
Index: cloud-init/cloudinit/DataSource.py
===================================================================
--- cloud-init.orig/cloudinit/DataSource.py
+++ cloud-init/cloudinit/DataSource.py
@@ -116,7 +116,7 @@ class DataSource:
hostname = socket.gethostname()
- fqdn = util.get_fqdn_from_hosts()
+ fqdn = util.get_fqdn_from_hosts(hostname)
if fqdn and fqdn.find(".") > 0:
toks = fqdn.split(".")

View File

@ -2,14 +2,14 @@
Name: cloud-init
Version: 0.6.2
Release: 0.4.bzr450%{?dist}
Release: 0.1.bzr457%{?dist}
Summary: Cloud 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
# bzr export -r 457 cloud-init-0.6.2-bzr457.tar.gz lp:cloud-init
Source0: %{name}-%{version}-bzr457.tar.gz
Source1: cloud-init-fedora.cfg
Source2: cloud-init-README.fedora
Patch0: cloud-init-0.6.2-fedora.patch
@ -17,9 +17,6 @@ Patch0: cloud-init-0.6.2-fedora.patch
# The current patch set is in flux as we stabilize cloud-init on Fedora.
# It will be submitted upstream as soon as it becomes reasonable to do so.
# Unbundle boto.utils
# https://bugs.launchpad.net/cloud-init/+bug/855965
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)
@ -34,8 +31,6 @@ Patch6: cloud-init-0.6.2-puppetcontext.patch
Patch7: cloud-init-0.6.2-puppetenable.patch
# Make the types of SSH keys to generate configurable (not yet upstream)
Patch8: cloud-init-0.6.2-sshkeytypes.patch
# https://bugs.launchpad.net/cloud-init/+bug/857891
Patch9: cloud-init-0.6.2-fqdnargs.patch
# https://bugs.launchpad.net/cloud-init/+bug/857926
Patch10: cloud-init-0.6.2-runparts-emptydir.patch
@ -67,9 +62,8 @@ ssh keys and to let the user run various scripts.
%prep
%setup -q -n %{name}-%{version}-bzr450
%setup -q -n %{name}-%{version}-bzr457
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
@ -77,7 +71,6 @@ ssh keys and to let the user run various scripts.
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
cp -p %{SOURCE2} README.fedora
@ -162,6 +155,9 @@ fi
%changelog
* Sat Sep 24 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.1.bzr457
- Rebased against upstream rev 457
* Fri Sep 23 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.4.bzr450
- Added more macros to the spec file

View File

@ -1 +1 @@
f02b6f11e2f16d9756f909526d17d0a0 cloud-init-0.6.2-bzr450.tar.gz
b8c9145213f6642e23270543fba24fb9 cloud-init-0.6.2-bzr457.tar.gz