--- euca2ools-1.2.orig/Makefile +++ euca2ools-1.2/Makefile @@ -55,11 +55,11 @@ install: build @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) $@) || exit $$? ; done - @install -g root -o root -m 755 -d $(PREFIX)/bin - @install -g root -o root -m 755 bin/* $(PREFIX)/bin/ - @install -g root -o root -m 755 -d $(PREFIX)/man/man1 - @if [ -d $(MANDIR) ]; then install -g root -o root -m 644 $(MANDIR)/* $(PREFIX)/man/man1; fi - @if [ -d $(BASH_COMPLETION) ]; then install -g root -o root -m 644 $(UTILDIR)/* $(BASH_COMPLETION); fi + @install -o root -m 755 -d $(PREFIX)/bin + @install -o root -m 755 bin/* $(PREFIX)/bin/ + @install -o root -m 755 -d $(PREFIX)/man/man1 + @if [ -d $(MANDIR) ]; then install -o root -m 644 $(MANDIR)/* $(PREFIX)/man/man1; fi + @if [ -d $(BASH_COMPLETION) ]; then install -o root -m 644 $(UTILDIR)/* $(BASH_COMPLETION); fi distclean clean: @for subdir in $(SUBDIRS); do \ --- euca2ools-1.2.orig/euca2ools.spec +++ euca2ools-1.2/euca2ools.spec @@ -78,12 +78,12 @@ cd ../euca2ools %{__python} setup.py install --prefix=$DESTDIR/usr cd .. -install -g root -o root -m 755 -d $DESTDIR/usr/bin -install -g root -o root -m 755 -d $DESTDIR/usr/man/man1 -install -g root -o root -m 755 -d $DESTDIR/%{__docdir}/euca2ools-%{version} -install -g root -o root -m 755 bin/* $DESTDIR/usr/bin -install -g root -o root -m 644 man/* $DESTDIR/usr/man/man1 -install -g root -o root -m 755 INSTALL COPYING README $DESTDIR/%{__docdir}/euca2ools-%{version} +install -o root -m 755 -d $DESTDIR/usr/bin +install -o root -m 755 -d $DESTDIR/usr/man/man1 +install -o root -m 755 -d $DESTDIR/%{__docdir}/euca2ools-%{version} +install -o root -m 755 bin/* $DESTDIR/usr/bin +install -o root -m 644 man/* $DESTDIR/usr/man/man1 +install -o root -m 755 INSTALL COPYING README $DESTDIR/%{__docdir}/euca2ools-%{version} %clean [ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT} --- euca2ools-1.2.orig/man/euca-describe-images.1 +++ euca2ools-1.2/man/euca-describe-images.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DESCRIBE-IMAGES "1" "January 2010" "euca-describe-images euca-describe-images version: 1.0 (BSD)" "User Commands" +.TH EUCA-DESCRIBE-IMAGES "1" "March 2010" "euca-describe-images Version: 1.2 (BSD)" "User Commands" .SH NAME euca-describe-images \- Eucalyptus tool: Shows information about machine images. .SH DESCRIPTION @@ -17,9 +17,9 @@ .PP \fB\-x\fR Show only images that the specified user is permitted to launch. .PP -\fB\-a\fR, \fB\-\-access\-key\fR User's Access Key ID. +\fB\-A\fR, \fB\-\-access\-key\fR User's Access Key ID. .PP -\fB\-s\fR, \fB\-\-secret\-key\fR User's Secret Key. +\fB\-S\fR, \fB\-\-secret\-key\fR User's Secret Key. .PP \fB\-U\fR, \fB\-\-url\fR URL of the Cloud to connect to. .PP --- euca2ools-1.2.orig/man/euca-describe-volumes.1 +++ euca2ools-1.2/man/euca-describe-volumes.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DESCRIBE-VOLUMES "1" "January 2010" "euca-describe-volumes euca-describe-volumes version: 1.0 (BSD)" "User Commands" +.TH EUCA-DESCRIBE-VOLUMES "1" "March 2010" "euca-describe-volumes Version: 1.2 (BSD)" "User Commands" .SH NAME euca-describe-volumes \- Eucalyptus tool: Shows information about volumes. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-describe-instances.1 +++ euca2ools-1.2/man/euca-describe-instances.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DESCRIBE-INSTANCES "1" "January 2010" "euca-describe-instances euca-describe-instances version: 1.0 (BSD)" "User Commands" +.TH EUCA-DESCRIBE-INSTANCES "1" "March 2010" "euca-describe-instances Version: 1.2 (BSD)" "User Commands" .SH NAME euca-describe-instances \- Eucalyptus tool: Shows information about instances. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-unbundle.1 +++ euca2ools-1.2/man/euca-unbundle.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-UNBUNDLE "1" "January 2010" "euca-unbundle euca-unbundle-image version: 1.0 (BSD)" "User Commands" +.TH EUCA-UNBUNDLE "1" "March 2010" "euca-unbundle Version: 1.2 (BSD)" "User Commands" .SH NAME euca-unbundle \- Eucalyptus tool: Unbundles a previously bundled image. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-revoke.1 +++ euca2ools-1.2/man/euca-revoke.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-REVOKE "1" "January 2010" "euca-revoke euca-revoke version: 1.0 (BSD)" "User Commands" +.TH EUCA-REVOKE "1" "March 2010" "euca-revoke Version: 1.2 (BSD)" "User Commands" .SH NAME euca-revoke \- Eucalyptus tool: Revoke a rule for a security group. .SH DESCRIPTION @@ -45,3 +45,48 @@ \fB\-\-debug\fR Turn on debugging. .PP Euca2ools will use the environment variables EC2_URL, EC2_ACCESS_KEY, EC2_SECRET_KEY, EC2_CERT, EC2_PRIVATE_KEY, S3_URL, EUCALYPTUS_CERT by default. +.PP +group_name must be specified +.PP +Revoke a rule for a security group. +.PP +euca\-revoke [\-P | \fB\-\-protocol\fR protocol] [\-p | \fB\-\-port\-range\fR port_range] +[\-t | \fB\-\-icmp\-type\-code\fR type:code] [\-o | \fB\-\-source\-group\fR source_group] +[\-u | \fB\-\-source\-group\-user\fR source_group_user] [\-s | \fB\-\-source\-subnet\fR source_subnet] +[\-h, \fB\-\-help]\fR [\-\-version] [\-\-debug] group_name +.PP +REQUIRED PARAMETERS +.PP +group_name Name of the group to add the rule to. +.PP +OPTIONAL PARAMETERS +.PP +\fB\-P\fR, \fB\-\-protocol\fR Protocol ("tcp" "udp" or "icmp"). +.PP +\fB\-p\fR, \fB\-\-port\-range\fR Range of ports for the rule (specified as "from\-to"). +.PP +\fB\-t\fR, \fB\-\-icmp\-type\-code\fR ICMP type and code specified as "type:code" +.PP +\fB\-o\fR, \fB\-\-source\-group\fR Group from which traffic is authorized by the rule. +.PP +\fB\-u\fR, \fB\-\-source\-group\-user\fR User ID for the source group. +.PP +\fB\-s\fR, \fB\-\-source\-subnet\fR The source subnet for the rule. +.PP +\fB\-A\fR, \fB\-\-access\-key\fR User's Access Key ID. +.PP +\fB\-S\fR, \fB\-\-secret\-key\fR User's Secret Key. +.PP +\fB\-U\fR, \fB\-\-url\fR URL of the Cloud to connect to. +.PP +\fB\-\-config\fR Read credentials and cloud settings from the +.IP +specified config file (defaults to $HOME/.eucarc or /etc/euca2ools/eucarc). +.PP +\fB\-h\fR, \fB\-\-help\fR Display this help message. +.PP +\fB\-\-version\fR Display the version of this tool. +.PP +\fB\-\-debug\fR Turn on debugging. +.PP +Euca2ools will use the environment variables EC2_URL, EC2_ACCESS_KEY, EC2_SECRET_KEY, EC2_CERT, EC2_PRIVATE_KEY, S3_URL, EUCALYPTUS_CERT by default. --- euca2ools-1.2.orig/man/euca-upload-bundle.1 +++ euca2ools-1.2/man/euca-upload-bundle.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-UPLOAD-BUNDLE "1" "January 2010" "euca-upload-bundle euca-upload-bundle version: 1.0 (BSD)" "User Commands" +.TH EUCA-UPLOAD-BUNDLE "1" "March 2010" "euca-upload-bundle Version: 1.2 (BSD)" "User Commands" .SH NAME euca-upload-bundle \- Eucalyptus tool: Upload a previously bundled image to the cloud. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-describe-availability-zones.1 +++ euca2ools-1.2/man/euca-describe-availability-zones.1 @@ -1,11 +1,11 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DESCRIBE-AVAILABILITY-ZONES "1" "January 2010" "euca-describe-availability-zones euca-describe-availability-zones version: 1.0 (BSD)" "User Commands" +.TH EUCA-DESCRIBE-AVAILABILITY-ZONES "1" "March 2010" "euca-describe-availability-zones Version: 1.2 (BSD)" "User Commands" .SH NAME euca-describe-availability-zones \- Eucalyptus tool: Shows information about availability zones. .SH DESCRIPTION Shows information about availability zones. .PP -euca\-describe\-availability\-zones [\-\-region region] [\-h, \fB\-\-help]\fR [\-\-version] [\-\-debug] [zone1 zone2...zoneN] +euca\-describe\-availability\-zones [\-\-region region] [\-h, \fB\-\-help]\fR [\-\-version] [\-\-debug] [zone1 zone2...zoneN] [verbose] .PP OPTIONAL PARAMETERS .PP @@ -13,6 +13,8 @@ .PP zone1 zone2...zoneN zones to describe. .PP +verbose show verbose resource information (Eucalyptus administrator\-only functionality). +.PP \fB\-a\fR, \fB\-\-access\-key\fR User's Access Key ID. .PP \fB\-s\fR, \fB\-\-secret\-key\fR User's Secret Key. --- euca2ools-1.2.orig/man/euca-create-snapshot.1 +++ euca2ools-1.2/man/euca-create-snapshot.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-CREATE-SNAPSHOT "1" "January 2010" "euca-create-snapshot euca-create-snapshot version: 1.0 (BSD)" "User Commands" +.TH EUCA-CREATE-SNAPSHOT "1" "March 2010" "euca-create-snapshot Version: 1.2 (BSD)" "User Commands" .SH NAME euca-create-snapshot \- Eucalyptus tool: Creates a snapshot from an existing volume. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-release-address.1 +++ euca2ools-1.2/man/euca-release-address.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-RELEASE-ADDRESS "1" "January 2010" "euca-release-address euca-release-address version: 1.0 (BSD)" "User Commands" +.TH EUCA-RELEASE-ADDRESS "1" "March 2010" "euca-release-address Version: 1.2 (BSD)" "User Commands" .SH NAME euca-release-address \- Eucalyptus tool: Releases a public IP address. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-download-bundle.1 +++ euca2ools-1.2/man/euca-download-bundle.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH BUCKET "1" "January 2010" "bucket must be specified." "User Commands" +.TH BUCKET "1" "March 2010" "bucket must be specified." "User Commands" .SH NAME bucket \- Eucalyptus tool: Downloads a bundled image from a bucket. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-bundle-vol.1 +++ euca2ools-1.2/man/euca-bundle-vol.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-BUNDLE-VOL "1" "January 2010" "euca-bundle-vol euca-bundle-vol version: 1.0 (BSD)" "User Commands" +.TH EUCA-BUNDLE-VOL "1" "March 2010" "euca-bundle-vol Version: 1.2 (BSD)" "User Commands" .SH NAME euca-bundle-vol \- Eucalyptus tool: Bundle the local filesystem of a running instance as a bundled image. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-terminate-instances.1 +++ euca2ools-1.2/man/euca-terminate-instances.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-TERMINATE-INSTANCES "1" "January 2010" "euca-terminate-instances euca-terminate-instances version: 1.0 (BSD)" "User Commands" +.TH EUCA-TERMINATE-INSTANCES "1" "March 2010" "euca-terminate-instances Version: 1.2 (BSD)" "User Commands" .SH NAME euca-terminate-instances \- Eucalyptus tool: Stops specified instances. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-register.1 +++ euca2ools-1.2/man/euca-register.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-REGISTER "1" "January 2010" "euca-register euca-register version: 1.0 (BSD)" "User Commands" +.TH EUCA-REGISTER "1" "March 2010" "euca-register Version: 1.2 (BSD)" "User Commands" .SH NAME euca-register \- Eucalyptus tool: Registers a manifest for use with the cloud. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-confirm-product-instance.1 +++ euca2ools-1.2/man/euca-confirm-product-instance.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-CONFIRM-PRODUCT-INSTANCE "1" "January 2010" "euca-confirm-product-instance euca-confirm-product-instance version: 1.0 (BSD)" "User Commands" +.TH EUCA-CONFIRM-PRODUCT-INSTANCE "1" "March 2010" "euca-confirm-product-instance Version: 1.2 (BSD)" "User Commands" .SH NAME euca-confirm-product-instance \- Eucalyptus tool: Confirm if instance is running with product code attached. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-reset-image-attribute.1 +++ euca2ools-1.2/man/euca-reset-image-attribute.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-RESET-IMAGE-ATTRIBUTE "1" "January 2010" "euca-reset-image-attribute euca-reset-image-attribute version: 1.0 (BSD)" "User Commands" +.TH EUCA-RESET-IMAGE-ATTRIBUTE "1" "March 2010" "euca-reset-image-attribute Version: 1.2 (BSD)" "User Commands" .SH NAME euca-reset-image-attribute \- Eucalyptus tool: Reset attributes for an image. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-delete-group.1 +++ euca2ools-1.2/man/euca-delete-group.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DELETE-GROUP "1" "January 2010" "euca-delete-group euca-delete-group version: 1.0 (BSD)" "User Commands" +.TH EUCA-DELETE-GROUP "1" "March 2010" "euca-delete-group Version: 1.2 (BSD)" "User Commands" .SH NAME euca-delete-group \- Eucalyptus tool: Deletes a security group. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-describe-regions.1 +++ euca2ools-1.2/man/euca-describe-regions.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DESCRIBE-REGIONS "1" "January 2010" "euca-describe-regions euca-describe-regions version: 1.0 (BSD)" "User Commands" +.TH EUCA-DESCRIBE-REGIONS "1" "March 2010" "euca-describe-regions Version: 1.2 (BSD)" "User Commands" .SH NAME euca-describe-regions \- Eucalyptus tool: Shows information about regions. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-delete-volume.1 +++ euca2ools-1.2/man/euca-delete-volume.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DELETE-VOLUME "1" "January 2010" "euca-delete-volume euca-delete-volume version: 1.0 (BSD)" "User Commands" +.TH EUCA-DELETE-VOLUME "1" "March 2010" "euca-delete-volume Version: 1.2 (BSD)" "User Commands" .SH NAME euca-delete-volume \- Eucalyptus tool: Deletes a volume. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-attach-volume.1 +++ euca2ools-1.2/man/euca-attach-volume.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-ATTACH-VOLUME "1" "January 2010" "euca-attach-volume euca-attach-volume version: 1.0 (BSD)" "User Commands" +.TH EUCA-ATTACH-VOLUME "1" "March 2010" "euca-attach-volume Version: 1.2 (BSD)" "User Commands" .SH NAME euca-attach-volume \- Eucalyptus tool: Attaches a volume to an instance. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-associate-address.1 +++ euca2ools-1.2/man/euca-associate-address.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-ASSOCIATE-ADDRESS "1" "January 2010" "euca-associate-address euca-associate-address version: 1.0 (BSD)" "User Commands" +.TH EUCA-ASSOCIATE-ADDRESS "1" "March 2010" "euca-associate-address Version: 1.2 (BSD)" "User Commands" .SH NAME euca-associate-address \- Eucalyptus tool: Associate an instance with a public IP address. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-describe-addresses.1 +++ euca2ools-1.2/man/euca-describe-addresses.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DESCRIBE-ADDRESSES "1" "January 2010" "euca-describe-addresses euca-describe-addresses version: 1.0 (BSD)" "User Commands" +.TH EUCA-DESCRIBE-ADDRESSES "1" "March 2010" "euca-describe-addresses Version: 1.2 (BSD)" "User Commands" .SH NAME euca-describe-addresses \- Eucalyptus tool: Shows information about addresses. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-delete-keypair.1 +++ euca2ools-1.2/man/euca-delete-keypair.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DELETE-KEYPAIR "1" "January 2010" "euca-delete-keypair euca-delete-keypair version: 1.0 (BSD)" "User Commands" +.TH EUCA-DELETE-KEYPAIR "1" "March 2010" "euca-delete-keypair Version: 1.2 (BSD)" "User Commands" .SH NAME euca-delete-keypair \- Eucalyptus tool: Delete a key pair. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-detach-volume.1 +++ euca2ools-1.2/man/euca-detach-volume.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DETACH-VOLUME "1" "January 2010" "euca-detach-volume euca-detach-volume version: 1.0 (BSD)" "User Commands" +.TH EUCA-DETACH-VOLUME "1" "March 2010" "euca-detach-volume Version: 1.2 (BSD)" "User Commands" .SH NAME euca-detach-volume \- Eucalyptus tool: Detaches a volume from an instance. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-add-keypair.1 +++ euca2ools-1.2/man/euca-add-keypair.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-ADD-KEYPAIR "1" "January 2010" "euca-add-keypair euca-add-keypair version: 1.0 (BSD)" "User Commands" +.TH EUCA-ADD-KEYPAIR "1" "March 2010" "euca-add-keypair Version: 1.2 (BSD)" "User Commands" .SH NAME euca-add-keypair \- Eucalyptus tool: Creates a new key pair for use with instances. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-describe-groups.1 +++ euca2ools-1.2/man/euca-describe-groups.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DESCRIBE-GROUPS "1" "January 2010" "euca-describe-groups euca-describe-groups version: 1.0 (BSD)" "User Commands" +.TH EUCA-DESCRIBE-GROUPS "1" "March 2010" "euca-describe-groups Version: 1.2 (BSD)" "User Commands" .SH NAME euca-describe-groups \- Eucalyptus tool: Shows information about groups. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-bundle-image.1 +++ euca2ools-1.2/man/euca-bundle-image.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-BUNDLE-IMAGE "1" "January 2010" "euca-bundle-image euca-bundle-image version: 1.0 (BSD)" "User Commands" +.TH EUCA-BUNDLE-IMAGE "1" "March 2010" "euca-bundle-image Version: 1.2 (BSD)" "User Commands" .SH NAME euca-bundle-image \- Eucalyptus tool: Bundles an image for use with Eucalyptus or Amazon EC2. .SH DESCRIPTION @@ -33,7 +33,7 @@ .PP \fB\-d\fR, \fB\-\-destination\fR Directory to store the bundled image in (default: "/tmp"). Recommended. .PP -\fB\-\-ec2cert_path\fR The path to the Cloud's X509 public key certificate. +\fB\-\-ec2cert\fR The path to the Cloud's X509 public key certificate. .PP \fB\-r\fR, \fB\-\-arch\fR Target architecture for the image ('x86_64' or 'i386' default: 'x86_64'). .PP --- euca2ools-1.2.orig/man/euca-describe-snapshots.1 +++ euca2ools-1.2/man/euca-describe-snapshots.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DESCRIBE-SNAPSHOTS "1" "January 2010" "euca-describe-snapshots euca-describe-snapshot version: 1.0 (BSD)" "User Commands" +.TH EUCA-DESCRIBE-SNAPSHOTS "1" "March 2010" "euca-describe-snapshots Version: 1.2 (BSD)" "User Commands" .SH NAME euca-describe-snapshots \- Eucalyptus tool: Shows information about snapshots. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-version.1 +++ euca2ools-1.2/man/euca-version.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH 1.0-31337 "1" "January 2010" "1.0-31337 2009-04-04" "User Commands" +.TH 1.2-31337 "1" "March 2010" "1.2-31337 2009-04-04" "User Commands" .SH NAME -1.0-31337 \- Eucalyptus tool: Shows the Euca2ools version +1.2-31337 \- Eucalyptus tool: Shows the Euca2ools version .SH DESCRIPTION Shows the Euca2ools version .PP --- euca2ools-1.2.orig/man/euca-modify-image-attribute.1 +++ euca2ools-1.2/man/euca-modify-image-attribute.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-MODIFY-IMAGE-ATTRIBUTE "1" "January 2010" "euca-modify-image-attribute euca-modify-image-attribute version: 1.0 (BSD)" "User Commands" +.TH EUCA-MODIFY-IMAGE-ATTRIBUTE "1" "March 2010" "euca-modify-image-attribute Version: 1.2 (BSD)" "User Commands" .SH NAME euca-modify-image-attribute \- Eucalyptus tool: Modify attributes for an image. .SH DESCRIPTION @@ -41,3 +41,44 @@ \fB\-\-debug\fR Turn on debugging. .PP Euca2ools will use the environment variables EC2_URL, EC2_ACCESS_KEY, EC2_SECRET_KEY, EC2_CERT, EC2_PRIVATE_KEY, S3_URL, EUCALYPTUS_CERT by default. +.PP +image_id must be specified +.PP +Modify attributes for an image. +.PP +euca\-modify\-image\-attribute [\-l, \fB\-\-launch\-permission]\fR [\-p, \fB\-\-product\-code]\fR +[\-a, \fB\-\-add\fR entity ] [\-r, \fB\-\-remove\fR entity] +[\-h, \fB\-\-help]\fR [\-\-version] [\-\-debug] image_id +.PP +REQUIRED PARAMETERS +.PP + +image_id Unique identifier for the image that you want to modify the attributes for. +.PP +OPTIONAL PARAMETERS +.PP +\fB\-l\fR, \fB\-\-launch\-permission\fR Show launch permissions. +.PP +\fB\-p\fR, \fB\-\-product\-code\fR Show the product codes associated with the image +.PP +\fB\-a\fR, \fB\-add\fR Entity (typically, user id) to add. +.PP +\fB\-r\fR, \fB\-\-remove\fR Entity (typically, user id) to remove. +.PP +\fB\-A\fR, \fB\-\-access\-key\fR User's Access Key ID. +.PP +\fB\-S\fR, \fB\-\-secret\-key\fR User's Secret Key. +.PP +\fB\-U\fR, \fB\-\-url\fR URL of the Cloud to connect to. +.PP +\fB\-\-config\fR Read credentials and cloud settings from the +.IP +specified config file (defaults to $HOME/.eucarc or /etc/euca2ools/eucarc). +.PP +\fB\-h\fR, \fB\-\-help\fR Display this help message. +.PP +\fB\-\-version\fR Display the version of this tool. +.PP +\fB\-\-debug\fR Turn on debugging. +.PP +Euca2ools will use the environment variables EC2_URL, EC2_ACCESS_KEY, EC2_SECRET_KEY, EC2_CERT, EC2_PRIVATE_KEY, S3_URL, EUCALYPTUS_CERT by default. --- euca2ools-1.2.orig/man/euca-run-instances.1 +++ euca2ools-1.2/man/euca-run-instances.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-RUN-INSTANCES "1" "January 2010" "euca-run-instances euca-run-instances version: 1.0 (BSD)" "User Commands" +.TH EUCA-RUN-INSTANCES "1" "March 2010" "euca-run-instances Version: 1.2 (BSD)" "User Commands" .SH NAME euca-run-instances \- Eucalyptus tool: Starts instances. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-disassociate-address.1 +++ euca2ools-1.2/man/euca-disassociate-address.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DISASSOCIATE-ADDRESS "1" "January 2010" "euca-disassociate-address euca-disassociate-address version: 1.0 (BSD)" "User Commands" +.TH EUCA-DISASSOCIATE-ADDRESS "1" "March 2010" "euca-disassociate-address Version: 1.2 (BSD)" "User Commands" .SH NAME euca-disassociate-address \- Eucalyptus tool: Disassociate a public IP address from an instance. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-deregister.1 +++ euca2ools-1.2/man/euca-deregister.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DEREGISTER "1" "January 2010" "euca-deregister euca-deregister version: 1.0 (BSD)" "User Commands" +.TH EUCA-DEREGISTER "1" "March 2010" "euca-deregister Version: 1.2 (BSD)" "User Commands" .SH NAME euca-deregister \- Eucalyptus tool: Deregisters an image from the cloud. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-delete-bundle.1 +++ euca2ools-1.2/man/euca-delete-bundle.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH BUCKET "1" "January 2010" "bucket must be specified." "User Commands" +.TH BUCKET "1" "March 2010" "bucket must be specified." "User Commands" .SH NAME bucket \- Eucalyptus tool: .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-add-group.1 +++ euca2ools-1.2/man/euca-add-group.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-ADD-GROUP "1" "January 2010" "euca-add-group euca-add-group version: 1.0 (BSD)" "User Commands" +.TH EUCA-ADD-GROUP "1" "March 2010" "euca-add-group Version: 1.2 (BSD)" "User Commands" .SH NAME euca-add-group \- Eucalyptus tool: Creates a new security group. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-authorize.1 +++ euca2ools-1.2/man/euca-authorize.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-AUTHORIZE "1" "January 2010" "euca-authorize euca-authorize version: 1.0 (BSD)" "User Commands" +.TH EUCA-AUTHORIZE "1" "March 2010" "euca-authorize Version: 1.2 (BSD)" "User Commands" .SH NAME euca-authorize \- Eucalyptus tool: Add a new rule to a security group. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-describe-image-attribute.1 +++ euca2ools-1.2/man/euca-describe-image-attribute.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DESCRIBE-IMAGE-ATTRIBUTE "1" "January 2010" "euca-describe-image-attribute euca-describe-image-attribute version: 1.0 (BSD)" "User Commands" +.TH EUCA-DESCRIBE-IMAGE-ATTRIBUTE "1" "March 2010" "euca-describe-image-attribute Version: 1.2 (BSD)" "User Commands" .SH NAME euca-describe-image-attribute \- Eucalyptus tool: Show image attributes. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-create-volume.1 +++ euca2ools-1.2/man/euca-create-volume.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-CREATE-VOLUME "1" "January 2010" "euca-create-volume euca-create-volume version: 1.0 (BSD)" "User Commands" +.TH EUCA-CREATE-VOLUME "1" "March 2010" "euca-create-volume Version: 1.2 (BSD)" "User Commands" .SH NAME euca-create-volume \- Eucalyptus tool: Creates a volume in a specified availability zone. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-delete-snapshot.1 +++ euca2ools-1.2/man/euca-delete-snapshot.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DELETE-SNAPSHOT "1" "January 2010" "euca-delete-snapshot euca-delete-snapshot version: 1.0 (BSD)" "User Commands" +.TH EUCA-DELETE-SNAPSHOT "1" "March 2010" "euca-delete-snapshot Version: 1.2 (BSD)" "User Commands" .SH NAME euca-delete-snapshot \- Eucalyptus tool: Deletes a snapshot. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-describe-keypairs.1 +++ euca2ools-1.2/man/euca-describe-keypairs.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-DESCRIBE-KEYPAIRS "1" "January 2010" "euca-describe-keypairs euca-describe-key-pairs version: 1.0 (BSD)" "User Commands" +.TH EUCA-DESCRIBE-KEYPAIRS "1" "March 2010" "euca-describe-keypairs Version: 1.2 (BSD)" "User Commands" .SH NAME euca-describe-keypairs \- Eucalyptus tool: Shows information about keypairs. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-reboot-instances.1 +++ euca2ools-1.2/man/euca-reboot-instances.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-REBOOT-INSTANCES "1" "January 2010" "euca-reboot-instances euca-reboot-instances version: 1.0 (BSD)" "User Commands" +.TH EUCA-REBOOT-INSTANCES "1" "March 2010" "euca-reboot-instances Version: 1.2 (BSD)" "User Commands" .SH NAME euca-reboot-instances \- Eucalyptus tool: Reboots specified instances. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-get-console-output.1 +++ euca2ools-1.2/man/euca-get-console-output.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-GET-CONSOLE-OUTPUT "1" "January 2010" "euca-get-console-output euca-get-console-output version: 1.0 (BSD)" "User Commands" +.TH EUCA-GET-CONSOLE-OUTPUT "1" "March 2010" "euca-get-console-output Version: 1.2 (BSD)" "User Commands" .SH NAME euca-get-console-output \- Eucalyptus tool: Prints console output from a running instance. .SH DESCRIPTION --- euca2ools-1.2.orig/man/euca-allocate-address.1 +++ euca2ools-1.2/man/euca-allocate-address.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH EUCA-ALLOCATE-ADDRESS "1" "January 2010" "euca-allocate-address euca-allocate-address version: 1.0 (BSD)" "User Commands" +.TH EUCA-ALLOCATE-ADDRESS "1" "March 2010" "euca-allocate-address Version: 1.2 (BSD)" "User Commands" .SH NAME euca-allocate-address \- Eucalyptus tool: Allocate a public IP address. .SH DESCRIPTION --- euca2ools-1.2.orig/euca2ools/setup.py +++ euca2ools-1.2/euca2ools/setup.py @@ -37,7 +37,7 @@ from distutils.core import setup setup(name = "euca2ools", - version = "1.0", + version = "1.2", description = "API tools compatible with Amazon AWS", long_description="API tools compliant with Amazon's AWS API. Work with Amazon AWS and Eucalyptus.", author = "Neil Soman", --- euca2ools-1.2.orig/euca2ools/euca2ools/__init__.py +++ euca2ools-1.2/euca2ools/euca2ools/__init__.py @@ -48,7 +48,7 @@ import logging BUNDLER_NAME = "euca-tools" -BUNDLER_VERSION = "1.0" +BUNDLER_VERSION = "1.2" VERSION = "2007-10-10" RELEASE = "31337" AES = 'AES-128-CBC' @@ -107,10 +107,7 @@ Popen(dd_cmd, PIPE).communicate()[0] def make_fs(self, image_path): - try: - Util().check_prerequisite_command(self.MAKEFS_CMD) - except NotFoundError: - sys.exit(1) + Util().check_prerequisite_command(self.MAKEFS_CMD) if self.debug: print "Creating filesystem..." @@ -170,15 +167,15 @@ def create_image(self, size_in_MB, image_path): print "Sorry. Solaris not supported yet" - sys.exit(1) + raise UnsupportedException def make_fs(self, image_path): print "Sorry. Solaris not supported yet" - sys.exit(1) + raise UnsupportedException def make_essential_devs(self, image_path): print "Sorry. Solaris not supported yet" - sys.exit(1) + raise UnsupportedException class Util: usage_string = """ @@ -199,13 +196,17 @@ Euca2ools will use the environment variables EC2_URL, EC2_ACCESS_KEY, EC2_SECRET_KEY, EC2_CERT, EC2_PRIVATE_KEY, S3_URL, EUCALYPTUS_CERT by default. """ - + + version_string = """ Version: 1.2 (BSD)""" + + def version(self): + return self.version_string + def usage(self, compat=False): if compat: self.usage_string = self.usage_string.replace("-s,", "-S,") self.usage_string = self.usage_string.replace("-a,", "-A,") print self.usage_string - sys.exit(1) def check_prerequisite_command(self, command): cmd = [command] @@ -267,8 +268,21 @@ def __init__(self): self.message = "Unable to find" +class UnsupportedException: + def __init__(self): + self.message = "Not supported" + +class CommandFailed: + def __init__(self): + self.message = "Command failed" +class ConnectionFailed: + def __init__(self): + self.message = "Connection failed" +class ParseError: + def __init__(self, msg): + self.message = msg class Euca2ool: @@ -336,67 +350,45 @@ SYSTEM_EUCARC_PATH = os.path.join("/etc", "euca2ools", "eucarc") def setup_environ(self): + envlist = ( 'EC2_ACCESS_KEY', 'EC2_SECRET_KEY', 'S3_URL', 'EC2_URL', + 'EC2_CERT', 'EC2_PRIVATE_KEY', 'EUCALYPTUS_CERT', + 'EC2_USER_ID' ) self.environ = {} user_eucarc = None if 'HOME' in os.environ: - os.path.join(os.getenv('HOME'), ".eucarc") - base_path = None + user_eucarc = os.path.join(os.getenv('HOME'), ".eucarc") read_config = False if self.config_file_path and os.path.exists(self.config_file_path): - base_path = os.path.dirname(self.config_file_path) - eucarc = open(self.config_file_path, "r") - read_config = True + read_config = self.config_file_path elif user_eucarc is not None and os.path.exists(user_eucarc): - base_path = os.path.dirname(user_eucarc) - eucarc = open(user_eucarc, "r") - read_config = True + read_config = user_eucarc elif os.path.exists(self.SYSTEM_EUCARC_PATH): - base_path = os.path.dirname(self.SYSTEM_EUCARC_PATH) - eucarc = open(self.SYSTEM_EUCARC_PATH, "r") - read_config = True + read_config = self.SYSTEM_EUCARC_PATH if read_config: - lines = eucarc.readlines() - comment = re.compile('^#') - for line in lines: - line = line.strip('export') - line = line.replace('\'', '') - line = line.strip() - line = line.replace('${EUCA_KEY_DIR}', base_path) - if not comment.match(line): - parts = line.split('=', 1) - if len(parts) == 2: - self.environ[parts[0]] = parts[1] - eucarc.close() - + parse_config(read_config, self.environ, envlist) else: - self.environ['EC2_ACCESS_KEY'] = os.getenv('EC2_ACCESS_KEY') - self.environ['EC2_SECRET_KEY'] = os.getenv('EC2_SECRET_KEY') - self.environ['S3_URL'] = os.getenv('S3_URL') - self.environ['EC2_URL'] = os.getenv('EC2_URL') - self.environ['EC2_CERT'] = os.getenv('EC2_CERT') - self.environ['EC2_PRIVATE_KEY'] = os.getenv('EC2_PRIVATE_KEY') - self.environ['EUCALYPTUS_CERT'] = os.getenv('EUCALYPTUS_CERT') - self.environ['EC2_USER_ID'] = os.getenv('EC2_USER_ID') + for v in envlist: + self.environ[v]=os.getenv(v) def get_environ(self, name): if self.environ.has_key(name): return self.environ[name] else: print '%s not found' % name - sys.exit(1) + raise NotFoundError def make_connection(self): if not self.ec2_user_access_key: self.ec2_user_access_key = self.environ['EC2_ACCESS_KEY'] if not self.ec2_user_access_key: print 'EC2_ACCESS_KEY environment variable must be set.' - sys.exit(1) + raise ConnectionFailed if not self.ec2_user_secret_key: self.ec2_user_secret_key = self.environ['EC2_SECRET_KEY'] if not self.ec2_user_secret_key: print 'EC2_SECRET_KEY environment variable must be set.' - sys.exit(1) + raise ConnectionFailed if not self.is_s3: if not self.ec2_url: @@ -483,8 +475,7 @@ return f_parts[len(f_parts) - 1] def get_file_path(self, filename): - relative_filename = self.get_relative_filename(filename) - file_path = filename.replace(relative_filename, '') + file_path=os.path.dirname(filename) if len(file_path) == 0: file_path = "." return file_path @@ -535,25 +526,14 @@ sha_image.update(buf) return image_size, hexlify(sha_image.digest()) -# def tarzip_image(self, prefix, file, path): -# print 'Tarring image' -# tar_file = '%s.tar.gz' % os.path.join(path, prefix) -# tar = tarfile.open(tar_file, "w|gz") -# tar.add(file, arcname=prefix) -# tar.close() -# return tar_file - def tarzip_image(self, prefix, file, path): - try: - Util().check_prerequisite_command('tar') - except NotFoundError: - sys.exit(1) + Util().check_prerequisite_command('tar') print 'Tarring image' tar_file = '%s.tar.gz' % os.path.join(path, prefix) outfile = open(tar_file, "wb") file_path = self.get_file_path(file) - tar_cmd = ["tar", "c", "-S"] + tar_cmd = ["tar", "ch", "-S"] if file_path: tar_cmd.append("-C") tar_cmd.append(file_path) @@ -566,7 +546,7 @@ outfile.close if os.path.getsize(tar_file) <= 0: print "Could not tar image" - sys.exit(1) + raise CommandFailed return tar_file def hexToBytes(self, hexString): @@ -932,16 +912,13 @@ os.makedirs(destination_path) if self.img == "Unsupported": print "Platform not fully supported." - sys.exit(1) + raise UnsupportedException self.img.create_image(size_in_MB, image_path) self.img.make_fs(image_path) return image_path def create_loopback(self, image_path): - try: - Util().check_prerequisite_command('losetup') - except NotFoundError: - sys.exit(1) + Util().check_prerequisite_command('losetup') tries = 0 while tries < MAX_LOOP_DEVS: loop_dev = Popen(["losetup", "-f"], stdout=PIPE).communicate()[0].replace('\n', '') @@ -951,14 +928,11 @@ return loop_dev else: print "Could not create loopback device. Aborting" - sys.exit(1) + raise CommandFailed tries += 1 def mount_image(self, image_path): - try: - Util().check_prerequisite_command('mount') - except NotFoundError: - sys.exit(1) + Util().check_prerequisite_command('mount') tmp_mnt_point = "/tmp/%s" % (hex(BN.rand(16)))[2:6] if not os.path.exists(tmp_mnt_point): @@ -986,7 +960,9 @@ print "Copying files..." for exclude in excludes: print "Excluding:", exclude - output = Popen(rsync_cmd, stdout=PIPE, stderr=PIPE).communicate() + + pipe = Popen(rsync_cmd, stdout=PIPE, stderr=PIPE) + output = pipe.communicate() for dir in self.img.ESSENTIAL_DIRS: dir_path = os.path.join(mount_point, dir) if not os.path.exists(dir_path): @@ -1010,14 +986,18 @@ print 'Making essential directory %s' % mount_location os.makedirs(dir_path) mtab_file.close() - if output[1]: - raise CopyError + if pipe.returncode: + # rsync return code 23: Partial transfer due to error + # rsync return code 24: Partial transfer due to vanished source files + if pipe.returncode in (23, 24): + print "Warning: rsync reports files partially copied:" + print output + else: + print "Error: rsync failed with return code %d" % pipe.returncode + raise CopyError def unmount_image(self, mount_point): - try: - Util().check_prerequisite_command('umount') - except NotFoundError: - sys.exit(1) + Util().check_prerequisite_command('umount') if self.debug: print "Unmounting image..." Popen(["umount", "-d", mount_point], stdout=PIPE).communicate()[0] @@ -1029,7 +1009,7 @@ output = self.copy_to_image(mount_point, volume_path, excludes) if self.img == "Unsupported": print "Platform not fully supported." - sys.exit(1) + raise UnsupportedException self.img.add_fstab(mount_point, generate_fstab, fstab_path) except CopyError: raise CopyError @@ -1095,3 +1075,48 @@ except Exception: print msg sys.exit(1) + +# read the config file 'config', update 'dict', setting +# the value from the config file for each element in array 'keylist' +# "config" is a bash syntax file defining bash variables +def parse_config(config, dict, keylist): + fmt = "" + str="" + for v in keylist: + str='%s "${%s}" ' % (str, v) + fmt=fmt + "%s%s" % ("%s", "\\0") + + cmd = [ "bash", "-ec", + ". '%s' >/dev/null; printf '%s' %s" \ + % ( config, fmt, str ) ] + + handle = Popen(cmd, stderr=PIPE, stdout=PIPE) + ( stdout, stderr) = handle.communicate() + if handle.returncode != 0: + raise ParseError("Parsing config file %s failed:\n\t%s" %(config, stderr)) + + values = stdout.split("\0") + for i in range(len(values) - 1): + if values[i] != "": + dict[keylist[i]]=values[i] + +def print_instances(instances, nil=""): + members=( "id", "image_id", "public_dns_name", "private_dns_name", + "state", "key_name", "ami_launch_index", "product_codes", + "instance_type", "launch_time", "placement", "kernel", + "ramdisk" ) + + for instance in instances: + # in old describe-instances, there was a check for 'if instance:' + # I (smoser) have carried this over, but dont know how instance + # could be false + if not instance: continue + items=[ ] + for member in members: + val = getattr(instance,member,nil) + # product_codes is a list + if val is None: val = nil + if hasattr(val,'__iter__'): + val = ','.join(val) + items.append(val) + print "INSTANCE\t%s" % '\t'.join(items) --- euca2ools-1.2.orig/debian/compat +++ euca2ools-1.2/debian/compat @@ -0,0 +1 @@ +7 --- euca2ools-1.2.orig/debian/README.Debian +++ euca2ools-1.2/debian/README.Debian @@ -0,0 +1,32 @@ +Euca2ools for Debian +==================== + +When installing this package, you may already have heard about the +concept of cloud computing which was brought to considerable attention +by the internet merchant Amazon and their EC2 (elastic compute cloud) +and S3 (storage) services. The Eucalyptus team provides such services +themselves, too, but with an Open Source infrastructure, while achieving +a binary compatibility with the Amazon API as an independent development. + +The initial idea behind the here represented concept of clouds is to +have remote storage space. That arbitrary data may also be bootable disk +images, and the EC2 functionality means to start one or multiple instances +of these. The images are not necessarily provided by the respective +user themselves, but they may instead be shared in communities. As such, +clouds may be perceived as a continuation of the community-driven Linux +distributions. + +This package provides the functionality to control disk images, i.e. to +upload, start or stop them. The images may be derived from already existing +images or be prepared from scratch via the Debian-typical boostrapping. +The latter process is wrapped up into the tool VMBuilder or other publicly +shared scripts on the internet. + +See also + + * http://open.eucalyptus.com/ + * http://aws.amazon.com/ec2/ + * http://alestic.com/ + * vmbuilder (Debian/Ubuntu packages) + * http://wiki.debian.org/Cloud + * http://wiki.debian.org/euca2ools --- euca2ools-1.2.orig/debian/pycompat +++ euca2ools-1.2/debian/pycompat @@ -0,0 +1 @@ +2 --- euca2ools-1.2.orig/debian/install +++ euca2ools-1.2/debian/install @@ -0,0 +1,2 @@ +bin/* /usr/bin/ +debian/cert-ec2.pem /usr/share/euca2ools/ --- euca2ools-1.2.orig/debian/rules +++ euca2ools-1.2/debian/rules @@ -0,0 +1,20 @@ +#!/usr/bin/make -f + +DEB_PYTHON_SYSTEM = pycentral + +binary/euca2ools:: + $(MAKE) man MANDIR=$(CURDIR)/debian/manpages-help2man + +DEB_SRCDIR = euca2ools +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/python-distutils.mk + +DEB_PYTHON_SETUP_CMD = setup.py + +DEB_INDEP_PACKAGES=euca2ools + +clean:: + $(MAKE) clean + $(RM) euca2ools/euca2ools/__init__.pyc + $(RM) --recursive euca2ools/euca2ools.egg-info + $(RM) --recursive $(CURDIR)/debian/manpages-help2man --- euca2ools-1.2.orig/debian/manpages +++ euca2ools-1.2/debian/manpages @@ -0,0 +1 @@ +debian/manpages-help2man/* --- euca2ools-1.2.orig/debian/README.ubuntu-merging +++ euca2ools-1.2/debian/README.ubuntu-merging @@ -0,0 +1,83 @@ +# This document is intended to describe the process by which we merge +# Eucalyptus euca2ools snapshots from source control into Ubuntu's development +# branch. +# +# The instructions below are written in shell format, and are suitable +# for copy-and-paste, but this README is not intended for arbitrary +# execution. +# +# Please update as necessary. +# +# -- Dustin Kirkland , 1 Jan 2010 + +# Current Eucalyptus Major.Minor version +VER=1.2 +DIR=$(mktemp -d) +cd $DIR + +# Grab the Upstream branch +bzr branch lp:~eucalyptus-maintainers/eucalyptus/euca2ools-1.0 upstream + +# Get the current revision number +cd upstream +REVNO=$(bzr revno) && echo $REVNO + +# Upstream currently has it's own debian packaging, which is *not* what we want +bzr rm debian +bzr commit -m "remove the upstream debian packaging directory" +bzr export --root euca2ools-$VER~bzr$REVNO ../euca2ools_$VER~bzr$REVNO.orig.tar.gz && ls -halF ../*_$VER~bzr$REVNO.orig.tar.gz +cd .. + +# Grab the Ubuntu branch +bzr branch lp:~ubuntu-core-dev/eucalyptus/euca2ools ubuntu +cd ubuntu + +# Do the Merge +bzr merge ../upstream +bzr conflicts + +################################## +# MANUAL STEP: Resolve Conflicts # +################################## + +# Get bugs fixed from upstream bzr log. Sanity check this!!! +LAST_REVNO=$(head -n 1 debian/changelog | sed "s/^.*bzr//" | sed "s/-.*$//") && echo $LAST_REVNO +cd ../upstream +BUGS_FIXED=$(bzr log --include-merges | egrep -B 999999999 "^revno: $LAST_REVNO$" | egrep "\#[0-9]{6}" | sed "s/\(#[0-9]\+\)/LP: \1\n/g" | sed "s/^.*LP: / - LP: /g" | egrep "\#[0-9]{6}" | sort -u) +echo " * Upstream merge fixes:" +echo "$BUGS_FIXED" +echo + +# Update new changelog +cd ../ubuntu +dch -i +# Edit bzr $REVNO, and update -0ubuntu1 +# Add $BUGS_FIXED info, note what's changed + +# Do an intermediate commit, to separate the upstream merge changes +# from our packaging changes +debcommit + +# Test the source build +bzr bd -S + +# Test the binary build +bzr bd + +############################## +# MANUAL STEP: Test Packages # +############################## + +# Update the changelog for release +dch -e +dch --release lucid + +# Commit and tag the release +debcommit --release +bzr push lp:~ubuntu-core-dev/eucalyptus/euca2ools + +# Build your source package +bzr bd -S + +# And upload! +dput ../euca2ools*_source.changes --- euca2ools-1.2.orig/debian/cert-ec2.pem +++ euca2ools-1.2/debian/cert-ec2.pem @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDzjCCAzegAwIBAgIJALDnZV+lpZdSMA0GCSqGSIb3DQEBBQUAMIGhMQswCQYD +VQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRv +d24xJzAlBgNVBAoTHkFtYXpvbiBEZXZlbG9wbWVudCBDZW50cmUgKFNBKTEMMAoG +A1UECxMDQUVTMREwDwYDVQQDEwhBRVMgVGVzdDEdMBsGCSqGSIb3DQEJARYOYWVz +QGFtYXpvbi5jb20wHhcNMDUwODA5MTYwMTA5WhcNMDYwODA5MTYwMTA5WjCBoTEL +MAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2Fw +ZSBUb3duMScwJQYDVQQKEx5BbWF6b24gRGV2ZWxvcG1lbnQgQ2VudHJlIChTQSkx +DDAKBgNVBAsTA0FFUzERMA8GA1UEAxMIQUVTIFRlc3QxHTAbBgkqhkiG9w0BCQEW +DmFlc0BhbWF6b24uY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8v/X5 +zZv8CAVfNmvBM0br/RUcf1wU8xC5d2otFQQsQKB3qiWoj3oHeOWskOlTPFVZ8N+/ +hEaMjyOUkg2+g6XEagCQtFCEBzUVoMjiQIBPiWj5CWkFtlav2zt33LZ0ErTND4xl +j7FQFqbaytHU9xuQcFO2p12bdITiBs5Kwoi9bQIDAQABo4IBCjCCAQYwHQYDVR0O +BBYEFPQnsX1kDVzPtX+38ACV8RhoYcw8MIHWBgNVHSMEgc4wgcuAFPQnsX1kDVzP +tX+38ACV8RhoYcw8oYGnpIGkMIGhMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2Vz +dGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xJzAlBgNVBAoTHkFtYXpvbiBE +ZXZlbG9wbWVudCBDZW50cmUgKFNBKTEMMAoGA1UECxMDQUVTMREwDwYDVQQDEwhB +RVMgVGVzdDEdMBsGCSqGSIb3DQEJARYOYWVzQGFtYXpvbi5jb22CCQCw52VfpaWX +UjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAJJlWll4uGlrqBzeIw7u +M3RvomlxMESwGKb9gI+ZeORlnHAyZxvd9XngIcjPuU+8uc3wc10LRQUCn45a5hFs +zaCp9BSewLCCirn6awZn2tP8JlagSbjrN9YShStt8S3S/Jj+eBoRvc7jJnmEeMkx +O0wHOzp5ZHRDK7tGULD6jCfU +-----END CERTIFICATE----- --- euca2ools-1.2.orig/debian/watch +++ euca2ools-1.2/debian/watch @@ -0,0 +1,6 @@ +version=3 + +http://eucalyptussoftware.com/downloads/releases/euca2ools-(.*).tar.gz + +# Nightly builds +#http://eucalyptussoftware.com/downloads/releases/nightly/euca2ools-(.*)-src.tar.gz --- euca2ools-1.2.orig/debian/README.source +++ euca2ools-1.2/debian/README.source @@ -0,0 +1,9 @@ +euca2ools for Debian +==================== + +Omitting the upstream-maintained debian folder to appear +in source distribution but presenting it in the diff.gz. + +The original tarball contained the man pages. These are +now auto-generated just the way that upstream produced +them originally. --- euca2ools-1.2.orig/debian/changelog +++ euca2ools-1.2/debian/changelog @@ -0,0 +1,222 @@ +euca2ools (1.2-0ubuntu8) lucid; urgency=low + + [ Scott Moser ] + * euca-run-instances: + - --keypair => --key in usage and man page, LP: #530816 + - print error rather than trace on invalid instance-count, LP: #546420 + - euca-describe-instances: output "running", not "running ", LP: #531453 + * euca-revoke: only show usage once with --help + * euca-download-bundle: fix usage, LP: #546567 + * euca-bundle-image: + - fix failure on --block-device-mapping, LP: #546548 + - print usage on --help if userid has '-', LP: #546526 + - fix failure when image name string is in dest string, LP: #522060 + * euca-describe-image-attribute: fix --kernel or --ramdisk when + image did not have emi or eri, LP: #546551 + + [ Dustin Kirkland ] + * Cherry-pick up to upstream r266, fixes: + - LP: #536876 - document euca-describe-availability-zones verbose + - LP: #526591 - enhance parsing of config file + - LP: #531076 - fix euca-describe-images against specific image + + -- Dustin Kirkland Thu, 25 Mar 2010 15:36:43 -0700 + +euca2ools (1.2-0ubuntu7) lucid; urgency=low + + [ Dustin Kirkland ] + * Try to get the Debian and Ubuntu packaging in better sync + - debian/watch: pulled from Debian + - debian/rules, debian/manpages: fix manpage building, cleanup, + and install + - debian/compat, debian/control: + + bump to debhelper 7 + + update homepage + + bump standards version + + bump python-boto dep (doesn't affect us, but gets us closer to + Debian's packaging) + + [ Scott Moser ] + * euca-describe-images returns same result sets as ec2-describe-images + LP: #541468 + + -- Dustin Kirkland Wed, 24 Mar 2010 16:14:44 -0700 + +euca2ools (1.2-0ubuntu6) lucid; urgency=low + + * Cherry-pick upstream bzr r262, fixes: + - LP: #530296 - euca-describe-images returns empty set if ami given + and owner != self (actually fixed in the last uploaded, neglected + to mention in changelog, do so now, for completeness) + + -- Dustin Kirkland Mon, 08 Mar 2010 14:35:23 -0600 + +euca2ools (1.2-0ubuntu5) lucid; urgency=low + + * Cherry pick fixes from upstream, up to bzr r265, fixes: + - LP: #522398 - throw exceptions instead of sys.exit(1) + - LP: #522396 - fix version string + - LP: #523332 - check rsync return code + - LP: #516738 - upstream fix for image store + - LP: #525137 - don't sys.exit(1) + - LP: #526697 - merge upstream fix for this one + - LP: #531076 - fix euca-describe-instances against one instance + - LP: #526591 - fix config file parsing + + -- Dustin Kirkland Fri, 05 Mar 2010 16:59:25 -0600 + +euca2ools (1.2-0ubuntu4) lucid; urgency=low + + * order kernel/ramdisk output correctly in euca-describe-images + LP: #526697 + + -- Scott Moser Tue, 23 Feb 2010 17:03:57 -0500 + +euca2ools (1.2-0ubuntu3) lucid; urgency=low + + [ Scott Moser ] + * euca2ools/euca2ools/__init__.py: ensure that euca-bundle-image supports + symlinks, LP: #522292 + + -- Dustin Kirkland Tue, 23 Feb 2010 13:51:42 -0600 + +euca2ools (1.2-0ubuntu2) lucid; urgency=low + + * Fix bug where users ~/.eucarc was not read. LP: #524652 + + -- Scott Moser Fri, 19 Feb 2010 15:31:13 -0500 + +euca2ools (1.2-0ubuntu1) lucid; urgency=low + + * Upstream has released euca2ools 1.2 at bzr 248; update package version + accordingly + + -- Dustin Kirkland Tue, 16 Feb 2010 14:37:02 -0600 + +euca2ools (1.2~bzr248-0ubuntu1) lucid; urgency=low + + * Merge from upstream bzr revision; should fix: + - LP: #517871 - fix euca-describe-volumes + + -- Dustin Kirkland Thu, 11 Feb 2010 16:17:10 -0600 + +euca2ools (1.2~bzr245-0ubuntu2) lucid; urgency=low + + * debian/control: recommend cloud-utils, which has some nice helper scripts + for bundling images, LP: #517696 + + -- Dustin Kirkland Thu, 11 Feb 2010 15:38:34 -0600 + +euca2ools (1.2~bzr245-0ubuntu1) lucid; urgency=low + + * Merge from upstream bzr revision; should fix: + - LP: #510982 - show kernel and ramdisk attributes + - LP: #516486 - fix attribute display + - LP: #516738 - fix ubuntu image store + + -- Dustin Kirkland Thu, 11 Feb 2010 15:35:07 -0600 + +euca2ools (1.1~bzr239-0ubuntu1) lucid; urgency=low + + * Merge from upstream bzr revision, should fix: + - LP: #507840 - indicate filename and path of manifest + + -- Dustin Kirkland Mon, 18 Jan 2010 16:40:00 +1300 + +euca2ools (1.1~bzr238-0ubuntu2) lucid; urgency=low + + * debian/cert-ec2.pem, bin/euca-bundle-vol, debian/links: add the ec2 + public cert to this package, such that users can build EC2 images + without installing ec2-ami-tools from multiverse, LP: #479836 + + -- Dustin Kirkland Thu, 07 Jan 2010 20:22:22 -0600 + +euca2ools (1.1~bzr238-0ubuntu1) lucid; urgency=low + + * Merge from upstream bzr revision; should fix: + - LP: #497495 - parse dir path correctly in euca-delete-bundle + - LP: #439366 - show kernel and ramdisk in euca-describe-images + - LP: #495618 - show blk dev mappings in euca-describe-image-attribute + - LP: #485106 - read credentials from config file + - LP: #450044 - create tmpfs mounts in euca-bundle-vol + - LP: #479823 - correctly handle userid in euca-bundle-vol + - LP: #461301 - fix user data encoding + * Also, created Ubuntu packaging branch, with a common root to the upstream + project + + -- Dustin Kirkland Tue, 05 Jan 2010 23:13:36 -0600 + +euca2ools (1.0+bzr20091007-0ubuntu2) lucid; urgency=low + + [ Scott Moser ] + * Do not base64 encode user-data in euca-run-instances, as boto takes + care of that (LP: #461156) + + -- Thierry Carrez Wed, 02 Dec 2009 10:08:14 +0100 + +euca2ools (1.0+bzr20091007-0ubuntu1) karmic; urgency=low + + * Upstream bugfix release (from bzr rev219), fixes: + - euca-describe-volume should show the zone for a volume (LP: #444105) + - euca-create-volume shouldn't show 'None' on failure (LP: #436947) + - euca-attach-volume should not proceed after error (LP: #444097) + - Remove --ec2cert_path typo in help (should be --ec2-cert) (LP: #444747) + + -- Thierry Carrez Mon, 12 Oct 2009 09:11:57 +0200 + +euca2ools (1.0+bzr20090923-0ubuntu1) karmic; urgency=low + + * Upstream bugfix release, fixes LP: #435126, LP: #430093. + + -- Thierry Carrez Wed, 23 Sep 2009 11:56:45 +0200 + +euca2ools (1.0+bzr20090731-1ubuntu2) karmic; urgency=low + + * Also bdep on python-boto since euca2ools also imports it. + + -- Loïc Minier Sat, 22 Aug 2009 17:45:21 +0200 + +euca2ools (1.0+bzr20090731-1ubuntu1) karmic; urgency=low + + * Build-dep on python-m2crypto for the euca2ools import to work (euca2ools + imports M2Crypto) when calling tools' with --help via help2man. + * Makefile: export PYTHONPATH for the whole loop of the manpages target as + it's needed for DESCR=`$$x --help ...`. + + -- Loïc Minier Sat, 22 Aug 2009 17:29:00 +0200 + +euca2ools (1.0+bzr20090731-1) unstable; urgency=low + + * Initial release (Closes: #537370). + * Final roundup-contributions by Steffen Moeller. + + -- chris grzegorczyk Sat, 01 Aug 2009 13:50:56 +0200 + +euca2ools (1.0-2euca1) UNRELEASED; urgency=low + + * Release 1.0 GA version + * Add README.debian + + -- chris grzegorczyk Thu, 16 Jul 2009 21:25:47 -0700 + +euca2ools (1.0-2) UNRELEASED; urgency=low + + * Further addition to debian/control. + - improved description + - versioned dependencies + * DIY of dynamically generate man pages with help2man + + -- chris grzegorczyk Wed, 08 Jul 2009 15:04:45 +0200 + +euca2ools (1.0-1) UNRELEASED; urgency=low + + * Updated packaging with fixes thanks to Steffen Moeller and David Wendt. + + -- chris grzegorczyk Tue, 07 Jul 2009 23:36:19 -0700 + +euca2ools (1.0-0euca1) UNRELEASED; urgency=low + + * Initial release. + + -- chris grzegorczyk Tue, 07 Jul 2009 11:26:26 -0700 + --- euca2ools-1.2.orig/debian/links +++ euca2ools-1.2/debian/links @@ -0,0 +1 @@ +usr/share/euca2ools/cert-ec2.pem etc/ssl/certs --- euca2ools-1.2.orig/debian/copyright +++ euca2ools-1.2/debian/copyright @@ -0,0 +1,68 @@ +This package was debianized by Soren Hansen on +Tue, 26 May 2009 11:30:48 +0200. + +Copyright: + Copyright 2009, Eucalyptus Systems, Inc. + All rights reserved. + +Author: + Neil Soman + +License: + Software License Agreement (BSD License) + + Redistribution and use of this software in source and binary forms, with or + without modification, are permitted provided that the following conditions + are met: + + Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + + Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +The single file debian/cert-ec2.pem is Amazon's EC2 public certificate, which +is required to sign image to upload and use in EC2. + +It was extracted from: + + http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.zip + +The rest of that package is: + +Upstream Author(s): + + Amazon.com + +Copyright: + + Copyright 2008 Amazon.com, Inc or its affiliates. + +License: + + Licensed under the Amazon Software License (the + "License"). You may not use this file except in compliance with the + License. A copy of the License is located at + http://aws.amazon.com/asl or in the "license" file accompanying this + file. This file is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See + the License for the specific language governing permissions and + limitations under the License + +The Debian packaging is (C) 2008, Soren Hansen and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. --- euca2ools-1.2.orig/debian/control +++ euca2ools-1.2/debian/control @@ -0,0 +1,38 @@ +Source: euca2ools +Section: utils +Priority: extra +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: chris grzegorczyk +DM-Upload-Allowed: yes +Build-Depends: cdbs, debhelper (>= 7), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6), help2man, python-m2crypto, python-boto +Standards-Version: 3.8.4 +XS-Python-Version: >= 2.5 +Homepage: http://open.eucalyptus.com/open/ + +Package: euca2ools +Architecture: all +Depends: ${python:Depends}, python-m2crypto (>= 0.19.1), python-boto (>= 1.8d), ${misc:Depends} +Recommends: cloud-utils +XB-Python-Version: ${python:Versions} +Description: managing cloud instances for Eucalyptus + EUCALYPTUS is an open source service overlay that implements elastic + computing using existing resources. The goal of EUCALYPTUS is to allow + sites with existing clusters and server infrastructure to co-host an + elastic computing service that is interface-compatible with Amazon's EC2. + . + Elastic Utility Computing Architecture for Linking Your Programs + To Useful Systems - is an open-source software infrastructure for + implementing "cloud computing" on clusters. Eucalyptus Systems is the + pioneer in open source cloud computing technology that delivers hybrid + cloud deployments for enterprise data centers. Leveraging Linux and web + service technologies that commonly exist in today's IT infrastructure, + Eucalyptus enables customers to quickly and easily create elastic clouds + in minutes. This "no lock-in" approach provides users with ultimate + flexibility when delivering their SLAs. + . + Eucalyptus is more than just virtualization. Along with building virtual + machines, the technology supports the network and storage infrastructure + within the cloud environment. Eucalyptus works with multiple flavors + of Linux including Ubuntu, OpenSuse, Debian, and CentOS. Eucalyptus + currently supports Xen and KVM hypervisors. These tools are meant to + be CLI compatible with the ec2-api-tools. --- euca2ools-1.2.orig/bin/euca-reset-image-attribute +++ euca2ools-1.2/bin/euca-reset-image-attribute @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Reset attributes for an image. @@ -51,14 +51,14 @@ """ -version_string = """ euca-reset-image-attribute version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -78,7 +78,7 @@ if not image_attribute: image_attribute = 'launchPermission' elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -87,7 +87,11 @@ break if image_id: - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: return_code = euca_conn.reset_image_attribute(image_id = image_id, attribute = image_attribute) --- euca2ools-1.2.orig/bin/euca-unbundle +++ euca2ools-1.2/bin/euca-unbundle @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, FileValidationError, DirValidationError, Util +from euca2ools import Euca2ool, FileValidationError, DirValidationError, Util, NotFoundError, CommandFailed import tarfile import gzip from xml.dom import minidom @@ -65,17 +65,17 @@ """ -version_string = """ euca-unbundle-image version: 1.0 (BSD)""" IMAGE_IO_CHUNK = 8 * 1024 IMAGE_SPLIT_CHUNK = IMAGE_IO_CHUNK * 1024; -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -85,8 +85,12 @@ except Exception, e: print e usage() - - private_key_path=euca.get_environ('EC2_PRIVATE_KEY') + + try: + private_key_path=euca.get_environ('EC2_PRIVATE_KEY') + except NotFoundError: + sys.exit(1) + manifest_path = None batch=False directory = '.' @@ -94,7 +98,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name in ('-k', '--privatekey'): private_key_path = value elif name in ('-m', '--manifest'): @@ -133,7 +137,12 @@ decrypted_image = euca.decrypt_image(image, encrypted_key, encrypted_iv, private_key_path) os.remove(image) print "Uncompressing image" - unencrypted_image = euca.untarzip_image(directory, decrypted_image) + try: + unencrypted_image = euca.untarzip_image(directory, decrypted_image) + except NotFoundError: + sys.exit(1) + except CommandFailed: + sys.exit(1) os.remove(decrypted_image) else: if not manifest_path: --- euca2ools-1.2.orig/bin/euca-reboot-instances +++ euca2ools-1.2/bin/euca-reboot-instances @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, InstanceValidationError, Util +from euca2ools import Euca2ool, InstanceValidationError, Util, ConnectionFailed usage_string = """ Reboots specified instances. @@ -47,14 +47,14 @@ """ -version_string = """ euca-reboot-instances version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -67,7 +67,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -80,7 +80,11 @@ print 'Invalid instance id' sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: return_code = euca_conn.reboot_instances(instance_ids) except Exception, ex: --- euca2ools-1.2.orig/bin/euca-describe-volumes +++ euca2ools-1.2/bin/euca-describe-volumes @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, VolumeValidationError, Util +from euca2ools import Euca2ool, VolumeValidationError, Util, ConnectionFailed usage_string = """ Shows information about volumes. @@ -47,14 +47,14 @@ """ -version_string = """ euca-describe-volumes version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_volumes(volumes, volume_ids): @@ -94,7 +94,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -106,7 +106,11 @@ print 'Invalid volume id' sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: volumes = euca_conn.get_all_volumes() except Exception, ex: --- euca2ools-1.2.orig/bin/euca-describe-keypairs +++ euca2ools-1.2/bin/euca-describe-keypairs @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Shows information about keypairs. @@ -47,14 +47,14 @@ """ -version_string = """ euca-describe-key-pairs version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_keypairs(keypairs, keypair_ids): @@ -79,12 +79,16 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() keypair_ids = euca.process_args() - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: keypairs = euca_conn.get_all_key_pairs() except Exception, ex: --- euca2ools-1.2.orig/bin/euca-describe-groups +++ euca2ools-1.2/bin/euca-describe-groups @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Shows information about groups. @@ -46,14 +46,14 @@ """ -version_string = """ euca-describe-groups version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_groups(groups, group_ids): @@ -90,12 +90,16 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() group_ids = euca.process_args() - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: groups = euca_conn.get_all_security_groups() except Exception, ex: --- euca2ools-1.2.orig/bin/euca-describe-availability-zones +++ euca2ools-1.2/bin/euca-describe-availability-zones @@ -33,12 +33,12 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Shows information about availability zones. -euca-describe-availability-zones [--region region] [-h, --help] [--version] [--debug] [zone1 zone2...zoneN] +euca-describe-availability-zones [--region region] [-h, --help] [--version] [--debug] [zone1 zone2...zoneN] [verbose] OPTIONAL PARAMETERS @@ -46,16 +46,17 @@ zone1 zone2...zoneN zones to describe. +verbose show verbose resource information (Eucalyptus administrator-only functionality). """ -version_string = """ euca-describe-availability-zones version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_zones(zones, zone_ids, region): @@ -77,7 +78,7 @@ if name == '--region': region = value elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -86,9 +87,14 @@ if region: os.environ['EC2_URL'] = 'https://' + region + ".ec2.amazonaws.com" zone_ids = euca.process_args() - euca_conn = euca.make_connection() try: - zones = euca_conn.get_all_zones(zone_ids) + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) + + try: + zones = euca_conn.get_all_zones(zone_ids) except Exception, ex: euca.display_error_and_exit('%s' % ex) --- euca2ools-1.2.orig/bin/euca-deregister +++ euca2ools-1.2/bin/euca-deregister @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Deregisters an image from the cloud. @@ -48,14 +48,14 @@ """ -version_string = """ euca-deregister version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -69,7 +69,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() elif name == '--debug': @@ -82,7 +82,11 @@ if image_id: - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: return_code = euca_conn.deregister_image(image_id = image_id) except Exception, ex: --- euca2ools-1.2.orig/bin/euca-register +++ euca2ools-1.2/bin/euca-register @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Registers a manifest for use with the cloud. @@ -48,14 +48,14 @@ """ -version_string = """ euca-register version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -70,7 +70,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -80,7 +80,11 @@ if image_location: - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: image_id = euca_conn.register_image(image_location = image_location) except Exception, ex: --- euca2ools-1.2.orig/bin/euca-authorize +++ euca2ools-1.2/bin/euca-authorize @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, AddressValidationError, ProtocolValidationError, Util +from euca2ools import Euca2ool, AddressValidationError, ProtocolValidationError, Util, ConnectionFailed usage_string = """ Add a new rule to a security group. @@ -63,14 +63,15 @@ """ -version_string = """ euca-authorize version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage(compat=True) + sys.exit(status) + def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -117,7 +118,7 @@ print "port must be an integer." sys.exit(1) elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -129,7 +130,11 @@ group_name = arg break - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) if group_name: if cidr_ip: --- euca2ools-1.2.orig/bin/euca-delete-volume +++ euca2ools-1.2/bin/euca-delete-volume @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, VolumeValidationError, Util +from euca2ools import Euca2ool, VolumeValidationError, Util, ConnectionFailed usage_string = """ Deletes a volume. @@ -48,14 +48,14 @@ """ -version_string = """ euca-delete-volume version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() @@ -71,7 +71,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -87,7 +87,11 @@ print 'Invalid volume id' sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: return_code = euca_conn.delete_volume(volume_id) except Exception, ex: --- euca2ools-1.2.orig/bin/euca-upload-bundle +++ euca2ools-1.2/bin/euca-upload-bundle @@ -34,7 +34,7 @@ import getopt, sys, os from xml.dom import minidom -from euca2ools import Euca2ool, FileValidationError, Util +from euca2ools import Euca2ool, FileValidationError, Util, ConnectionFailed from boto.exception import S3ResponseError, S3CreateError from boto.s3 import Connection from boto.s3.key import Key @@ -66,14 +66,14 @@ """ -version_string = """ euca-upload-bundle version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def create_bucket(connection, bucket, canned_acl=None): @@ -178,7 +178,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name in ('-b', '--bucket'): bucket = value elif name in ('-m', '--manifest'): @@ -205,7 +205,12 @@ print 'Invalid manifest' sys.exit(1) - conn = euca.make_connection() + try: + conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) + bucket_instance = ensure_bucket(conn, bucket, canned_acl) parts = get_parts(manifest_path) if not directory: --- euca2ools-1.2.orig/bin/euca-associate-address +++ euca2ools-1.2/bin/euca-associate-address @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, AddressValidationError, InstanceValidationError, Util +from euca2ools import Euca2ool, AddressValidationError, InstanceValidationError, Util, ConnectionFailed usage_string = """ Associate an instance with a public IP address. @@ -51,14 +51,14 @@ """ -version_string = """ euca-associate-address version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -76,11 +76,15 @@ if name in ('-i', '--instance'): instance_id = value elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) for arg in euca.args: ip = arg --- euca2ools-1.2.orig/bin/euca-describe-instances +++ euca2ools-1.2/bin/euca-describe-instances @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, InstanceValidationError, Util +from euca2ools import Euca2ool, InstanceValidationError, Util, ConnectionFailed, print_instances usage_string = """ Shows information about instances. @@ -47,14 +47,14 @@ """ -version_string = """ euca-describe-instances version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_reservations(reservations, instance_ids): @@ -77,32 +77,8 @@ reservation_string += '%s%s' % (group_delim, group.id) group_delim = ', ' print 'RESERVATION\t%s' % (reservation_string) - for instance in instances: - if instance: - instance_string = '%s\t%s\t%s\t%s\t%s' % (instance.id, instance.image_id, instance.public_dns_name, instance.private_dns_name, instance.state) - if instance.key_name: - instance_string += ' \t%s' % instance.key_name - if instance.ami_launch_index: - instance_string += ' \t%s' % instance.ami_launch_index - if instance.product_codes: - first = True - for p in instance.product_codes: - if first: - instance_string += ' \t%s' % p - first = False - else: - instance_string += ',%s' % p - if instance.instance_type: - instance_string += ' \t%s' % instance.instance_type - if instance.launch_time: - instance_string += ' \t%s' % instance.launch_time - if instance.placement: - instance_string += ' \t%s' % instance.placement - if instance.kernel: - instance_string += ' \t%s' % instance.kernel - if instance.ramdisk: - instance_string += ' \t%s' % instance.ramdisk - print 'INSTANCE\t%s' % (instance_string) + + print_instances(instances) def main(): euca = None @@ -114,7 +90,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -126,7 +102,11 @@ print 'Invalid instance id' sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: reservations = euca_conn.get_all_instances(instance_ids) except Exception, ex: --- euca2ools-1.2.orig/bin/euca-delete-bundle +++ euca2ools-1.2/bin/euca-delete-bundle @@ -34,7 +34,7 @@ import getopt, sys, os from xml.dom import minidom -from euca2ools import Euca2ool, FileValidationError, Util +from euca2ools import Euca2ool, FileValidationError, Util, ConnectionFailed from boto.exception import S3ResponseError from boto.s3 import Connection from boto.s3.key import Key @@ -65,14 +65,14 @@ """ -version_string = """ euca-delete-bundle version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def ensure_bucket(connection, bucket): @@ -159,7 +159,11 @@ if (s3error_string.find('200') < 0): print s3error_string print 'unable to delete manifest %s' % (manifest) - bucket = ensure_bucket(euca.make_connection(), bucket_name) + try: + bucket = ensure_bucket(euca.make_connection(), bucket_name) + except ConnectionFailed, e: + print e.message + sys.exit(1) if clear: try: bucket.delete() @@ -193,7 +197,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name in ('-b', '--bucket'): bucket = value elif name in ('-m', '--manifest'): @@ -210,8 +214,11 @@ except FileValidationError: print 'Invalid manifest' sys.exit(1) - - conn = euca.make_connection() + try: + conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) bucket_instance = ensure_bucket(conn, bucket) manifests = None delete_local_manifests = True --- euca2ools-1.2.orig/bin/euca-detach-volume +++ euca2ools-1.2/bin/euca-detach-volume @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, VolumeValidationError, Util +from euca2ools import Euca2ool, VolumeValidationError, Util, ConnectionFailed usage_string = """ Detaches a volume from an instance. @@ -48,14 +48,14 @@ """ -version_string = """ euca-detach-volume version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def get_volume_params(volumes, volume_id): @@ -84,7 +84,7 @@ elif name in ('-d', '--device'): device = value elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -99,7 +99,11 @@ print 'Invalid volume id', volume_id sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: return_code = euca_conn.detach_volume(volume_id = volume_id) except Exception, ex: --- euca2ools-1.2.orig/bin/euca-run-instances +++ euca2ools-1.2/bin/euca-run-instances @@ -33,12 +33,12 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed, print_instances usage_string = """ Starts instances. -euca-run-instances [-n, --instance-count count] [-g, --group group_name] [-k, --keypair keyname] +euca-run-instances [-n, --instance-count count] [-g, --group group_name] [-k, --key keyname] [--addressing addressing] [-t, --instance-type instance_type] [-z, --availability-zone zone] [--kernel kernel_id] [--ramdisk ramdisk_id] [-h, --help] [--version] [--debug] image_id @@ -52,7 +52,7 @@ -g, --group Security group to run the instance under. --k, --keypair Name of a (previously created) keypair to associate with this reservation. +-k, --key Name of a (previously created) keypair to associate with this reservation. -d, --user-data User data for instances read from the command line. @@ -70,14 +70,14 @@ """ -version_string = """ euca-run-instances version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_reservations(reservation): @@ -87,9 +87,7 @@ reservation_string += '%s%s' % (group_delim, group.id) group_delim = ', ' print 'RESERVATION\t%s' % (reservation_string) - for instance in reservation.instances: - instance_string = '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s' % (instance.id, instance.image_id, instance.public_dns_name, instance.private_dns_name, instance.state, instance.key_name, instance.launch_time, instance.kernel, instance.ramdisk) - print 'INSTANCE\t%s' % (instance_string) + print_instances(reservation.instances) def read_user_data(user_data_filename): USER_DATA_CHUNK_SIZE = 512 @@ -134,11 +132,16 @@ ramdisk_id = value elif name in ('-n', '--instance-count'): counts = value.split('-') - if (len(counts) > 1): - min_count = int(counts[0]) - max_count = int(counts[1]) - else: - min_count = max_count = int(counts[0]) + try: + if (len(counts) > 1): + min_count = int(counts[0]) + max_count = int(counts[1]) + else: + min_count = max_count = int(counts[0]) + except ValueError: + print "Invalid value for --instance-count: ", value + sys.exit(1) + elif name in ('-t', '--instance-type'): instance_type = value elif name in ('-g', '--group'): @@ -152,7 +155,7 @@ elif name in ('-z', '--availability-zone'): zone = value elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -169,7 +172,11 @@ print 'Invalid user data file path' sys.exit(1) user_data = read_user_data(user_data_file) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: reservation = euca_conn.run_instances(image_id = image_id, min_count = min_count, --- euca2ools-1.2.orig/bin/euca-describe-image-attribute +++ euca2ools-1.2/bin/euca-describe-image-attribute @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Show image attributes. @@ -56,14 +56,14 @@ """ -version_string = """ euca-describe-image-attribute version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() @@ -79,9 +79,9 @@ for product_code in image_attribute.attrs['product_codes']: print 'productCodes\t%s\tproductCode\t%s' % (image_attribute.image_id, product_code) if image_attribute.kernel is not None: - print 'kernel\t%s\t\t%s' % (image_attribute.image_id, image_attribute.value) + print 'kernel\t%s\t\t%s' % (image_attribute.image_id, getattr(image_attribute, 'value', "")) if image_attribute.ramdisk is not None: - print 'ramdisk\t%s\t\t%s' % (image_attribute.image_id, image_attribute.value) + print 'ramdisk\t%s\t\t%s' % (image_attribute.image_id, getattr(image_attribute, 'value', "")) if image_attribute.name == 'block_device_mapping': for i in range(0, len(image_attribute.attrs['virtual_names'])): print 'blockDeviceMapping\t%s\tblockDeviceMap\t%s: %s' % (image_id, image_attribute.attrs['virtual_names'][i], image_attribute.attrs['device_names'][i]) @@ -116,7 +116,7 @@ if not image_attribute: image_attribute = 'ramdisk' elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -125,7 +125,11 @@ break if image_id and image_attribute: - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: image_attribute = euca_conn.get_image_attribute(image_id = image_id, attribute = image_attribute) --- euca2ools-1.2.orig/bin/euca-revoke +++ euca2ools-1.2/bin/euca-revoke @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, AddressValidationError, ProtocolValidationError, Util +from euca2ools import Euca2ool, AddressValidationError, ProtocolValidationError, Util, ConnectionFailed usage_string = """ Revoke a rule for a security group. @@ -63,15 +63,15 @@ """ -version_string = """ euca-revoke version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage(compat=True) + sys.exit(status) def version(): - print version_string - sys.exit() + print Util().version() + sys.exit(status) def main(): euca = None @@ -118,7 +118,7 @@ print "port must be an integer." sys.exit(1) elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -145,7 +145,11 @@ print 'Invalid protocol', protocol sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: return_code = euca_conn.revoke_security_group(group_name = group_name, src_security_group_name = source_group_name, --- euca2ools-1.2.orig/bin/euca-describe-addresses +++ euca2ools-1.2/bin/euca-describe-addresses @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, AddressValidationError, Util +from euca2ools import Euca2ool, AddressValidationError, Util, ConnectionFailed usage_string = """ Shows information about addresses. @@ -46,14 +46,14 @@ """ -version_string = """ euca-describe-addresses version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_addresses(addresses, address_ids): @@ -77,7 +77,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -89,7 +89,11 @@ print 'Invalid address' sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: addresses = euca_conn.get_all_addresses() except Exception, ex: --- euca2ools-1.2.orig/bin/euca-download-bundle +++ euca2ools-1.2/bin/euca-download-bundle @@ -34,7 +34,7 @@ import getopt, sys, os from xml.dom import minidom -from euca2ools import Euca2ool, FileValidationError, Util +from euca2ools import Euca2ool, FileValidationError, Util, ConnectionFailed from boto.exception import S3ResponseError from boto.s3 import Connection from boto.s3.key import Key @@ -47,24 +47,24 @@ REQUIRED PARAMETERS --b, --bucket The name of the bucket to download to. Bucket will be created if it does not exist. +-b, --bucket The name of the bucket to download from. OPTIONAL PARAMETERS --m, --manifest_path The path to the manifest file. +-m, --manifest The path to the manifest file. -d, --directory The name of the directory to download the bundled parts to. """ -version_string = """ euca-download-bundle version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def ensure_bucket(connection, bucket): @@ -141,7 +141,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name in ('-d', '--directory'): directory = value elif name in ('-b', '--bucket'): @@ -157,7 +157,12 @@ print 'Invalid manifest', manifest_path sys.exit(1) - conn = euca.make_connection() + try: + conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) + bucket_instance = ensure_bucket(conn, bucket) manifests = get_manifests(bucket_instance) download_manifests(bucket_instance, manifests, directory) --- euca2ools-1.2.orig/bin/euca-release-address +++ euca2ools-1.2/bin/euca-release-address @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, AddressValidationError, Util +from euca2ools import Euca2ool, AddressValidationError, Util, ConnectionFailed usage_string = """ Releases a public IP address. @@ -48,14 +48,14 @@ """ -version_string = """ euca-release-address version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -70,7 +70,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -86,7 +86,11 @@ print 'Invalid address' sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: return_code = euca_conn.release_address(ip) except Exception, ex: --- euca2ools-1.2.orig/bin/euca-get-console-output +++ euca2ools-1.2/bin/euca-get-console-output @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, InstanceValidationError, Util +from euca2ools import Euca2ool, InstanceValidationError, Util, ConnectionFailed usage_string = """ Prints console output from a running instance. @@ -48,14 +48,14 @@ """ -version_string = """ euca-get-console-output version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_console_output(console_output): @@ -74,7 +74,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() elif name == '--debug': @@ -92,7 +92,11 @@ print 'Invalid instance id' sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: console_output = euca_conn.get_console_output(instance_id) except Exception, ex: --- euca2ools-1.2.orig/bin/euca-attach-volume +++ euca2ools-1.2/bin/euca-attach-volume @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, VolumeValidationError, InstanceValidationError, Util +from euca2ools import Euca2ool, VolumeValidationError, InstanceValidationError, Util, ConnectionFailed usage_string = """ Attaches a volume to an instance. @@ -53,14 +53,14 @@ """ -version_string = """ euca-attach-volume version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -82,11 +82,15 @@ elif name in ('-d', '--device'): device = value elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) for arg in euca.args: volume_id = arg --- euca2ools-1.2.orig/bin/euca-delete-keypair +++ euca2ools-1.2/bin/euca-delete-keypair @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Delete a key pair. @@ -48,14 +48,14 @@ """ -version_string = """ euca-delete-keypair version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_keypair(keypair): @@ -74,7 +74,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -82,7 +82,11 @@ keypair_name = arg break - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) if keypair_name: try: return_code = euca_conn.delete_key_pair(keypair_name) --- euca2ools-1.2.orig/bin/euca-create-snapshot +++ euca2ools-1.2/bin/euca-create-snapshot @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, VolumeValidationError, Util +from euca2ools import Euca2ool, VolumeValidationError, Util, ConnectionFailed usage_string = """ Creates a snapshot from an existing volume. @@ -48,14 +48,14 @@ """ -version_string = """ euca-create-snapshot version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_snapshot(snapshot): @@ -76,11 +76,15 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) for arg in euca.args: volume_id = arg --- euca2ools-1.2.orig/bin/euca-version +++ euca2ools-1.2/bin/euca-version @@ -36,7 +36,7 @@ from euca2ools import Euca2ool, Util -TOOLS_VERSION = "1.0-31337" +TOOLS_VERSION = "1.2-31337" API_VERSION = "2009-04-04" usage_string = """ @@ -45,14 +45,13 @@ euca-version [-h, --help] [--debug] """ -version_string = """ euca-version version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string - sys.exit() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_tools_version(): @@ -68,7 +67,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) display_tools_version() --- euca2ools-1.2.orig/bin/euca-delete-snapshot +++ euca2ools-1.2/bin/euca-delete-snapshot @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, SnapshotValidationError, Util +from euca2ools import Euca2ool, SnapshotValidationError, Util, ConnectionFailed usage_string = """ Deletes a snapshot. @@ -48,14 +48,14 @@ """ -version_string = """ euca-delete-snapshot version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -70,7 +70,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -86,7 +86,12 @@ print 'Invalid snapshot id' sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) + return_code = euca_conn.delete_snapshot(snapshot_id) if return_code: print 'SNAPSHOT\t%s' % (snapshot_id) --- euca2ools-1.2.orig/bin/euca-describe-regions +++ euca2ools-1.2/bin/euca-describe-regions @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Shows information about regions. @@ -47,14 +47,14 @@ """ -version_string = """ euca-describe-regions version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_regions(regions, region_ids): @@ -78,12 +78,16 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() region_ids = euca.process_args() - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: regions = euca_conn.get_all_regions() except Exception, ex: --- euca2ools-1.2.orig/bin/euca-modify-image-attribute +++ euca2ools-1.2/bin/euca-modify-image-attribute @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Modify attributes for an image. @@ -57,15 +57,14 @@ -r, --remove Entity (typically, user id) to remove. """ -version_string = """ euca-modify-image-attribute version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage(compat=True) def version(): - print version_string - sys.exit() + print Util().version() + sys.exit(status) def main(): euca = None @@ -100,7 +99,7 @@ entity = value operation_type = 'remove' elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -115,7 +114,11 @@ user_ids = [entity] if image_id: - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: return_code = euca_conn.modify_image_attribute(image_id = image_id, attribute = image_attribute, --- euca2ools-1.2.orig/bin/euca-confirm-product-instance +++ euca2ools-1.2/bin/euca-confirm-product-instance @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, InstanceValidationError, Util +from euca2ools import Euca2ool, InstanceValidationError, Util, ConnectionFailed usage_string = """ Confirm if instance is running with product code attached. @@ -50,14 +50,14 @@ """ -version_string = """ euca-confirm-product-instance version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() @@ -76,7 +76,7 @@ if name in ('-i', '--instance'): instance_id = value elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -84,7 +84,11 @@ product_code = arg break - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) if instance_id and product_code: try: --- euca2ools-1.2.orig/bin/euca-bundle-image +++ euca2ools-1.2/bin/euca-bundle-image @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, FileValidationError, Util +from euca2ools import Euca2ool, FileValidationError, Util, NotFoundError, CommandFailed usage_string = """ Bundles an image for use with Eucalyptus or Amazon EC2. @@ -66,26 +66,24 @@ -d, --destination Directory to store the bundled image in (default: "/tmp"). Recommended. ---ec2cert_path The path to the Cloud's X509 public key certificate. +--ec2cert The path to the Cloud's X509 public key certificate. -r, --arch Target architecture for the image ('x86_64' or 'i386' default: 'x86_64'). --batch Run in batch mode (compatibility only. has no effect). """ -version_string = """ euca-bundle-image version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() - sys.exit() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def get_block_devs(mapping): - mapping = [] mapping_pairs = mapping.split(',') for m in mapping_pairs: m_parts = m.split('=') @@ -119,27 +117,26 @@ kernel=None user=None ramdisk=None - cert_path=euca.get_environ('EC2_CERT') - private_key_path=euca.get_environ('EC2_PRIVATE_KEY') + try: + cert_path=euca.get_environ('EC2_CERT') + private_key_path=euca.get_environ('EC2_PRIVATE_KEY') + ec2cert_path=euca.get_environ('EUCALYPTUS_CERT') + user_string = euca.get_environ('EC2_USER_ID') + except NotFoundError: + sys.exit(1) + prefix=None destination_path='/tmp' - ec2cert_path=euca.get_environ('EUCALYPTUS_CERT') target_arch='x86_64' mapping = None product_codes = None product_code_string = None - user_string = euca.get_environ("EC2_USER_ID") if user_string: - try: - user = int(user_string) - except ValueError: - print 'Invalid user', user_string - sys.exit() - user = user_string + user = user_string.replace('-', '') for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name in ('-i', '--image'): image_path = value elif name in ('-c', '--cert'): @@ -147,13 +144,7 @@ elif name in ('-k', '--privatekey'): private_key_path = value elif name in ('-u', '--user'): - try: - value = value.replace('-', '') - user = int(value) - except ValueError: - print 'Invalid user', value - sys.exit() - user = value + user = value.replace('-','') elif name == '--kernel': kernel = value elif name == '--ramdisk': @@ -178,6 +169,12 @@ version() if image_path and cert_path and private_key_path and user and ec2cert_path: + try: + int(user) + except ValueError: + print 'Invalid user', user + sys.exit(1) + try: euca.validate_file(image_path) except FileValidationError: @@ -202,7 +199,13 @@ image_size, sha_image_digest = euca.check_image(image_path, destination_path) if not prefix: prefix = euca.get_relative_filename(image_path) - tgz_file = euca.tarzip_image(prefix, image_path, destination_path) + try: + tgz_file = euca.tarzip_image(prefix, image_path, destination_path) + except NotFoundError: + sys.exit(1) + except CommandFailed: + sys.exit(1) + encrypted_file, key, iv, bundled_size = euca.encrypt_image(tgz_file) os.remove(tgz_file) parts, parts_digest = euca.split_image(encrypted_file) --- euca2ools-1.2.orig/bin/euca-terminate-instances +++ euca2ools-1.2/bin/euca-terminate-instances @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, InstanceValidationError, Util +from euca2ools import Euca2ool, InstanceValidationError, Util, ConnectionFailed usage_string = """ Stops specified instances. @@ -49,14 +49,14 @@ """ -version_string = """ euca-terminate-instances version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_instances(instances, instance_ids): @@ -73,7 +73,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -86,7 +86,11 @@ print 'Invalid instance id' sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: instances = euca_conn.terminate_instances(instance_ids) except Exception, ex: --- euca2ools-1.2.orig/bin/euca-disassociate-address +++ euca2ools-1.2/bin/euca-disassociate-address @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, AddressValidationError, Util +from euca2ools import Euca2ool, AddressValidationError, Util, ConnectionFailed usage_string = """ Disassociate a public IP address from an instance. @@ -48,14 +48,14 @@ """ -version_string = """ euca-disassociate-address version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -70,7 +70,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -86,8 +86,13 @@ print 'Invalid address', ip sys.exit(1) - euca_conn = euca.make_connection() - try: + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) + + try: return_code = euca_conn.disassociate_address(public_ip = ip) except Exception, ex: euca.display_error_and_exit('%s' % ex) --- euca2ools-1.2.orig/bin/euca-create-volume +++ euca2ools-1.2/bin/euca-create-volume @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, SizeValidationError, SnapshotValidationError, Util +from euca2ools import Euca2ool, SizeValidationError, SnapshotValidationError, Util, ConnectionFailed usage_string = """ Creates a volume in a specified availability zone. @@ -53,14 +53,14 @@ """ -version_string = """ euca-create-volume version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage(compat=True) + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_volume(volume): @@ -99,11 +99,15 @@ elif name == '--snapshot': snapshot_id = value elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) if (size or snapshot_id) and zone: if size: --- euca2ools-1.2.orig/bin/euca-add-group +++ euca2ools-1.2/bin/euca-add-group @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Util, Euca2ool +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Creates a new security group. @@ -49,14 +49,14 @@ """ -version_string = """ euca-add-group version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_group(group): @@ -78,11 +78,15 @@ if name in ('-d', '--description'): group_description = value elif name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) for arg in euca.args: group_name = arg --- euca2ools-1.2.orig/bin/euca-describe-images +++ euca2ools-1.2/bin/euca-describe-images @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Shows information about machine images. @@ -52,24 +52,18 @@ """ -version_string = """ euca-describe-images version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage(compat=True) + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() -def display_images(images, image_ids): - check_image_ids = False - if(len(image_ids) > 0): - check_image_ids = True +def display_images(images): for image in images: - if check_image_ids: - if not image.id in image_ids: - continue image_string = '%s\t%s\t%s\t%s' % (image.id, image.location, image.ownerId, image.state) if image.is_public: image_string += '\tpublic' @@ -79,7 +73,7 @@ image_string += '\t%s' % ','.join(image.product_codes) for i in [image.architecture, image.type, - image.ramdisk_id, image.kernel_id]: + image.kernel_id, image.ramdisk_id]: image_string += '\t%s' % ("" if i == None else i) print 'IMAGE\t%s' % (image_string) @@ -99,7 +93,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '-x': if defaults: executable_by = [] @@ -118,14 +112,22 @@ version() image_ids = euca.process_args() - #This is workaround for an issue with the front end (does not return an image set when an image id is specified LP:356389) - euca_conn = euca.make_connection() + if defaults and len(image_ids) > 0: + executable_by = ['self', 'all'] + owners = [] + + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) + try: - images = euca_conn.get_all_images(owners=owners, executable_by=executable_by) + images = euca_conn.get_all_images(image_ids=image_ids, owners=owners, executable_by=executable_by) except Exception, ex: euca.display_error_and_exit('%s' % ex) - display_images(images, image_ids) + display_images(images) if __name__ == "__main__": main() --- euca2ools-1.2.orig/bin/euca-describe-snapshots +++ euca2ools-1.2/bin/euca-describe-snapshots @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, SnapshotValidationError, Util +from euca2ools import Euca2ool, SnapshotValidationError, Util, ConnectionFailed usage_string = """ Shows information about snapshots. @@ -47,14 +47,14 @@ """ -version_string = """ euca-describe-snapshot version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_snapshots(snapshots, snapshot_ids): @@ -79,7 +79,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -91,7 +91,11 @@ print 'Invalid snapshot id' sys.exit(1) - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: snapshots = euca_conn.get_all_snapshots() except Exception, ex: --- euca2ools-1.2.orig/bin/euca-add-keypair +++ euca2ools-1.2/bin/euca-add-keypair @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Creates a new key pair for use with instances. @@ -48,14 +48,14 @@ """ -version_string = """ euca-add-keypair version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def display_keypair(keypair): @@ -76,11 +76,15 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) for arg in euca.args: keypair_name = arg --- euca2ools-1.2.orig/bin/euca-bundle-vol +++ euca2ools-1.2/bin/euca-bundle-vol @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, FileValidationError, DirValidationError, CopyError, MetadataReadError, Util +from euca2ools import Euca2ool, FileValidationError, DirValidationError, CopyError, MetadataReadError, Util, NotFoundError, CommandFailed, UnsupportedException from subprocess import * import platform @@ -88,14 +88,13 @@ MAX_IMAGE_SIZE = 1024 * 10 -version_string = """ euca-bundle-vol version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string - sys.exit() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def check_root(): @@ -186,12 +185,17 @@ kernel=None user=None ramdisk=None - cert_path=euca.get_environ('EC2_CERT') - private_key_path=euca.get_environ('EC2_PRIVATE_KEY') + try: + cert_path=euca.get_environ('EC2_CERT') + private_key_path=euca.get_environ('EC2_PRIVATE_KEY') + ec2cert_path=euca.get_environ('EUCALYPTUS_CERT') + user_string = euca.get_environ('EC2_USER_ID') + except NotFoundError: + sys.exit(1) + prefix='image' size_in_MB = 10*1024 destination_path='/disk1' - ec2cert_path=euca.get_environ('EUCALYPTUS_CERT') target_arch='x86_64' mapping = None excludes_string = None @@ -204,7 +208,6 @@ fstab_path = None generate_fstab = False product_code_string = None - user_string = euca.get_environ("EC2_USER_ID") if user_string: try: user = int(user_string) @@ -215,7 +218,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name in ('-c', '--cert'): cert_path = value elif name in ('-k', '--privatekey'): @@ -263,7 +266,10 @@ product_code_string = value elif name == '--version': version() - + + if not ec2cert_path: + ec2cert_path = "/usr/share/euca2ools/cert-ec2.pem" + if size_in_MB and cert_path and private_key_path and user and ec2cert_path: try: euca.validate_file(cert_path) @@ -309,8 +315,13 @@ if inherit: ramdisk, kernel, mapping, product_codes, ancestor_ami_ids = get_instance_metadata(euca, ramdisk, kernel, mapping) if product_code_string: - product_codes = add_product_codes(product_code_string, product_codes) - image_path = euca.make_image(size_in_MB, excludes, prefix, destination_path) + product_codes = add_product_codes(product_code_string, product_codes) + try: + image_path = euca.make_image(size_in_MB, excludes, prefix, destination_path) + except NotFoundError: + sys.exit(1) + except UnsupportedException: + sys.exit(1) image_path = os.path.normpath(image_path) if (image_path.find(volume_path) == 0): exclude_image = image_path.replace(volume_path, "", 1) @@ -324,11 +335,26 @@ print "Unable to copy files" cleanup(image_path) sys.exit(1) + except NotFoundError: + cleanup(image_path) + sys.exit(1) + except CommandFailed: + cleanup(image_path) + sys.exit(1) + except UnsupportedException: + cleanup(image_path) + sys.exit(1) image_size, sha_image_digest = euca.check_image(image_path, destination_path) if not prefix: prefix = euca.get_relative_filename(image_path) - tgz_file = euca.tarzip_image(prefix, image_path, destination_path) + try: + tgz_file = euca.tarzip_image(prefix, image_path, destination_path) + except NotFoundError: + sys.exit(1) + except CommandFailed: + sys.exit(1) + encrypted_file, key, iv, bundled_size = euca.encrypt_image(tgz_file) os.remove(tgz_file) parts, parts_digest = euca.split_image(encrypted_file) --- euca2ools-1.2.orig/bin/euca-allocate-address +++ euca2ools-1.2/bin/euca-allocate-address @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Allocate a public IP address. @@ -44,14 +44,14 @@ """ -version_string = """ euca-allocate-address version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -64,11 +64,15 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() - euca_conn = euca.make_connection() + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) try: address = euca_conn.allocate_address() --- euca2ools-1.2.orig/bin/euca-delete-group +++ euca2ools-1.2/bin/euca-delete-group @@ -33,7 +33,7 @@ # Author: Neil Soman neil@eucalyptus.com import getopt, sys, os -from euca2ools import Euca2ool, Util +from euca2ools import Euca2ool, Util, ConnectionFailed usage_string = """ Deletes a security group. @@ -48,14 +48,14 @@ """ -version_string = """ euca-delete-group version: 1.0 (BSD)""" -def usage(): +def usage(status=1): print usage_string Util().usage() + sys.exit(status) def version(): - print version_string + print Util().version() sys.exit() def main(): @@ -70,7 +70,7 @@ for name, value in euca.opts: if name in ('-h', '--help'): - usage() + usage(0) elif name == '--version': version() @@ -79,14 +79,18 @@ break if group_name: - euca_conn = euca.make_connection() - try: + try: + euca_conn = euca.make_connection() + except ConnectionFailed, e: + print e.message + sys.exit(1) + try: return_code = euca_conn.delete_security_group(name = group_name) except Exception, ex: euca.display_error_and_exit('%s' % ex) - if return_code: - print 'GROUP\t%s' % (group_name) + if return_code: + print 'GROUP\t%s' % (group_name) else: print 'group_name must be specified' usage()