[pkg-eucalyptus-commits] [SCM] managing cloud instances for Eucalyptus branch, master, updated. 3.0.0-alpha3-257-g1da8e3a
Garrett Holmstrom
gholms at fedoraproject.org
Sun Jun 16 02:29:54 UTC 2013
The following commit has been merged in the master branch:
commit 5e19a4f19df7334328c8b00074d855e398b537b9
Merge: e2213e334a45862044858e4a9c41bf55e01532cc bf89688b26b1f0f3087a96d725c681df13975136
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date: Sat May 19 13:57:43 2012 -0700
Merge branch 'master' into requestbuilder
Conflicts:
euca2ools/__init__.py
euca2ools/commands/euca/describeimages.py
euca2ools/commands/euca/describesnapshots.py
diff --combined euca2ools/commands/eustore/installimage.py
index 5829169,b33390c..b2ef8e4
mode 100644,100755..100644
--- a/euca2ools/commands/eustore/installimage.py
+++ b/euca2ools/commands/eustore/installimage.py
@@@ -47,8 -47,8 +47,8 @@@ from boto.s3.connection import Locatio
import euca2ools.bundler
import euca2ools.commands.eustore
import euca2ools.utils
-from euca2ools.commands.euca.bundleimage import BundleImage
-from euca2ools.commands.euca.uploadbundle import UploadBundle
+from euca2ools.commands.bundle.bundleimage import BundleImage
+from euca2ools.commands.bundle.uploadbundle import UploadBundle
from euca2ools.commands.euca.register import Register
from euca2ools.exceptions import NotFoundError, CommandFailed
@@@ -139,9 -139,15 +139,15 @@@ class InstallImage(AWSQueryRequest)
long_name='ramdisk',
optional=True,
ptype='string',
- doc="""Override bundled ramdisk with one already installed""")
+ doc="""Override bundled ramdisk with one already installed"""),
+ Param(name='yes',
+ short_name='y',
+ long_name='yes',
+ optional=True,
+ ptype='boolean',
+ doc="""Answer \"yes\" to questions during install""")
]
-
+ ImageList = None
def get_relative_filename(self, filename):
return os.path.split(filename)[-1]
@@@ -153,10 -159,44 +159,44 @@@
file_path = '.'
return file_path
+ def promptReplace(self, type, name):
+ if self.cli_options.yes:
+ print type+": "+name+" is already installed on the cloud, skipping installation of another one."
+ return True
+ else:
+ answer = raw_input(type+": "+name+" is already installed on ths cloud. Would you like to use it intead?(y/N)")
+ if (answer=='y' or answer=='Y'):
+ return True
+ return False
+
def bundleFile(self, path, name, description, arch, kernel_id=None, ramdisk_id=None):
bundler = euca2ools.bundler.Bundler(self)
path = self.destination + path
+ # before we do anything substantial, check to see if this "image" was already installed
+ ret_id=None
+ for img in self.ImageList:
+ name_match=False
+ if img.location.endswith(name+'.manifest.xml'):
+ name_match=True
+ # always replace skip if found
+ if name_match:
+ if kernel_id=='true' and img.type=='kernel':
+ if self.promptReplace("Kernel", img.name):
+ ret_id=img.name
+ break
+ elif ramdisk_id=='true' and img.type=='ramdisk':
+ if self.promptReplace("Ramdisk", img.name):
+ ret_id=img.name
+ break
+ elif kernel_id!='true' and ramdisk_id!='true' and img.type=='machine':
+ if self.promptReplace("Image", img.name):
+ ret_id=img.name
+ break
+
+ if ret_id:
+ return ret_id
+
image_size = bundler.check_image(path, self.destination)
try:
(tgz_file, sha_tar_digest) = bundler.tarzip_image(name, path, self.destination)
@@@ -206,10 -246,10 +246,10 @@@
try:
names = bundler.untarzip_image(self.destination, file)
except OSError:
- print "Error: cannot unbundle image, possibly corrupted file 1"
+ print "Error: cannot unbundle image, possibly corrupted file"
sys.exit(-1)
except IOError:
- print "Error: cannot unbundle image, possibly corrupted file 2"
+ print "Error: cannot unbundle image, possibly corrupted file"
sys.exit(-1)
kernel_dir=None
if not(self.cli_options.kernel_type==None):
@@@ -222,9 -262,7 +262,7 @@@
if kernel_id==None:
for i in [0, 1]:
tar_root = os.path.commonprefix(names)
- print "tar root = "+tar_root
for path in names:
- print "path = "+path
if (kernel_dir==None or path.find(kernel_dir) > -1):
name = os.path.basename(path)
if not(kernel_dir) and (os.path.dirname(path) != tar_root):
@@@ -311,6 -349,13 +349,13 @@@
print "Error: must be cloud admin to upload kernel/ramdisk. try specifying existing ones with --kernel and --ramdisk"
sys.exit(-1)
self.eustore_url = self.ServiceClass.StoreBaseURL
+
+ # would be good of this were async, i.e. when the tarball is downloading
+ ec2_conn = boto.connect_euca(host=euare_svc.args['host'], \
+ aws_access_key_id=euare_svc.args['aws_access_key_id'],\
+ aws_secret_access_key=euare_svc.args['aws_secret_access_key'])
+ self.ImageList = ec2_conn.get_all_images()
+
if os.environ.has_key('EUSTORE_URL'):
self.eustore_url = os.environ['EUSTORE_URL']
@@@ -338,6 -383,14 +383,14 @@@
image_found = True
break
if image_found:
+ # more param checking now
+ if image['single-kernel']=='True':
+ if self.cli_options.kernel_type:
+ print "The -k option will be ignored because the image is single-kernel"
+ else:
+ if not(self.cli_options.kernel_type):
+ print "Error: The -k option must be specified because this image has separate kernels"
+ sys.exit(-1)
print "Downloading Image : ",image['description']
imageURL = self.eustore_url+image['url']
req = urllib2.Request(imageURL, headers=self.ServiceClass.RequestHeaders)
@@@ -364,7 -417,7 +417,7 @@@
if image['name'] == crc.rjust(10,"0"):
print "Installed image: "+self.bundleAll(fp.name, None, image['description'], image['architecture'])
else:
- print "Downloaded image was incomplete or corrupt, please try again"
+ print "Error: Downloaded image was incomplete or corrupt, please try again"
os.remove(fp.name)
else:
print "Image name not found, please run eustore-describe-images"
diff --combined setup.py
index b773009,bd86517..c7148d4
--- a/setup.py
+++ b/setup.py
@@@ -169,15 -169,17 +169,18 @@@ setup(name = "euca2ools"
"bin/eustore-install-image"],
url = "http://open.eucalyptus.com",
packages = ["euca2ools", "euca2ools.nc", "euca2ools.commands",
- "euca2ools.commands.euca", "euca2ools.commands.euare",
- "euca2ools.commands.eustore"],
+ "euca2ools.commands.bundle", "euca2ools.commands.euca",
+ "euca2ools.commands.euare", "euca2ools.commands.eustore",
+ "euca2ools.commands.walrus"],
license = 'BSD (Simplified)',
platforms = 'Posix; MacOS X; Windows',
- classifiers = [ 'Development Status :: 3 - Alpha',
- 'Intended Audience :: Users',
- 'License :: OSI Approved :: Simplified BSD License',
- 'Operating System :: OS Independent',
- 'Topic :: Internet',
- ],
- classifiers = ['Development Status :: 4 - Beta',
++ classifiers = ['Development Status :: 2 - Pre-Alpha',
+ 'Intended Audience :: Users',
+ 'License :: OSI Approved :: Simplified BSD License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Topic :: Internet'],
)
--
managing cloud instances for Eucalyptus
More information about the pkg-eucalyptus-commits
mailing list