Hello community,

here is the log from the commit of package python3-ec2imgutils for 
openSUSE:Factory checked in at 2020-05-26 17:19:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-ec2imgutils (Old)
 and      /work/SRC/openSUSE:Factory/.python3-ec2imgutils.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python3-ec2imgutils"

Tue May 26 17:19:15 2020 rev:8 rq:808021 version:8.0.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-ec2imgutils/python3-ec2imgutils.changes  
2020-03-30 23:06:15.744274238 +0200
+++ 
/work/SRC/openSUSE:Factory/.python3-ec2imgutils.new.2738/python3-ec2imgutils.changes
        2020-05-26 17:19:35.216009193 +0200
@@ -1,0 +2,13 @@
+Wed May 20 19:00:49 UTC 2020 - Robert Schweikert <[email protected]>
+
+- Update to version 8.0.0 (bsc#1171933)
+  + Incompatible command line argument change for ec2publishimg. The
+    --allow-copy option is no longer a bolean. It now supports the
+    image and none keywords as well as a comma separated list of AWS account
+    numbers.
+  + Support having the snapshot copy permissions set differently than the
+    image copy permissions. This supports published image aggregation into
+    AWS MP.
+  + ec2uploadimg tags the helper instance
+
+-------------------------------------------------------------------

Old:
----
  ec2imgutils-7.0.9.tar.bz2

New:
----
  ec2imgutils-8.0.0.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python3-ec2imgutils.spec ++++++
--- /var/tmp/diff_new_pack.gykkUQ/_old  2020-05-26 17:19:36.448011842 +0200
+++ /var/tmp/diff_new_pack.gykkUQ/_new  2020-05-26 17:19:36.452011850 +0200
@@ -19,7 +19,7 @@
 %define upstream_name ec2imgutils
 
 Name:           python3-ec2imgutils
-Version:        7.0.9
+Version:        8.0.0
 Release:        0
 Summary:        Image management utilities for AWS EC2
 License:        GPL-3.0-or-later

++++++ ec2imgutils-7.0.9.tar.bz2 -> ec2imgutils-8.0.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ec2imgutils-7.0.9/ec2publishimg 
new/ec2imgutils-8.0.0/ec2publishimg
--- old/ec2imgutils-7.0.9/ec2publishimg 2020-03-23 15:07:21.262538112 +0100
+++ new/ec2imgutils-8.0.0/ec2publishimg 2020-05-21 17:00:19.711235412 +0200
@@ -1,6 +1,6 @@
 #!/usr/bin/python3
 
-# Copyright 2018 SUSE LLC
+# Copyright 2020 SUSE LLC
 #
 # This file is part of ec2imgutils
 #
@@ -42,17 +42,16 @@
     help='AWS access key (Optional)',
     metavar='AWS_ACCESS_KEY'
 )
-help_msg = 'Allow the image to be copied into the account(s) the image is '
-help_msg += 'shared with (Optional)'
+help_msg = 'Allow the image to be copied. image, none, or a comma '
+help_msg += 'separated list of AWS account numbers, default "none". (Optional)'
 argparse.add_argument(
     '--allow-copy',
-    action='store_true',
-    default=False,
+    default='none',
     dest='allowCopy',
     help=help_msg
 )
 help_msg = 'Do not perform any action, print information about actions that '
-help_msg += 'would be performed instead (Optional)'
+help_msg += 'would be performed instead, default "False" (Optional)'
 argparse.add_argument(
     '-n', '--dry-run',
     action='store_true',
@@ -115,11 +114,13 @@
     help='AWS secret access key (Optional)',
     metavar='AWS_SECRET_KEY'
 )
+help_msg = 'all, none, or a comma separated list of AWS account numbers '
+help_msg += 'to share the image(s) with, default "all"'
 argparse.add_argument(
     '--share-with',
     default='all',
     dest='share',
-    help='all, none, or a AWS account number to share the image(s) with',
+    help=help_msg,
     metavar='SHARE'
 )
 argparse.add_argument(
@@ -127,7 +128,7 @@
     action='store_true',
     default=False,
     dest='verbose',
-    help='Enable on verbose output'
+    help='Enable verbose output, default "False"'
 )
 argparse.add_argument(
     '--version',
@@ -203,6 +204,16 @@
     sys.exit(1)
 
 regions = utils.get_regions(args, access_key, secret_key)
+snap_copy = args.allowCopy.lower()
+if (
+        snap_copy != 'image' and
+        snap_copy != 'none' and not
+        utils.validate_account_numbers(snap_copy)
+):
+    msg = 'Expecting "image", "none", or comma separated list of 12 digit AWS '
+    msg += 'account numbers as value of --allow-copy'
+    print(msg, file=sys.stderr)
+    sys.exit(1)
 
 visibility = args.share.lower()
 if (
@@ -220,7 +231,7 @@
 
 publisher = ec2pubimg.EC2PublishImage(
         access_key=access_key,
-        allow_copy=args.allowCopy,
+        allow_copy=snap_copy,
         image_id=args.pubImgID,
         image_name=args.pubImgName,
         image_name_fragment=args.pubImgNameFrag,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ec2imgutils-7.0.9/ec2uploadimg 
new/ec2imgutils-8.0.0/ec2uploadimg
--- old/ec2imgutils-7.0.9/ec2uploadimg  2020-03-23 15:07:21.262538112 +0100
+++ new/ec2imgutils-8.0.0/ec2uploadimg  2020-05-21 17:00:19.711235412 +0200
@@ -22,18 +22,30 @@
 import os
 import sys
 import signal
+import traceback
 
 import ec2imgutils.ec2utils as utils
 import ec2imgutils.ec2uploadimg as ec2upimg
-from ec2imgutils.ec2imgutilsExceptions import (
-    EC2AccountException,
-    EC2UploadImgException
-)
+from ec2imgutils.ec2imgutilsExceptions import EC2AccountException
 from ec2imgutils.ec2setup import EC2Setup
 
 aborted = False
 
 
+def print_ex(verbose, msg=None):
+    (type, value, tb) = sys.exc_info()
+    if (verbose > 1):
+        traceback.print_exc(file=sys.stderr)
+        if msg:
+            print(msg, file=sys.stderr)
+
+    else:
+        if msg is None:
+            print("{}: {}".format(type.__name__, value), file=sys.stderr)
+        else:
+            print(msg, file=sys.stderr)
+
+
 def signal_handler(signum, frame):
     global aborted
     if aborted:
@@ -247,13 +259,15 @@
     help=help_msg,
     metavar='AWS_VIRT_TYPE'
 )
+help_msg = 'Enable verbose output (Optional). Multiple -v options increase '
+help_msg += 'the verbosity. The maximum is 2.'
 argparse.add_argument(
     '--verbose',
-    action='store_true',
-    default=False,
+    '-v',
+    action='count',
+    default=0,
     dest='verbose',
-    help='Enable verbose output (Optional)'
-)
+    help=help_msg)
 argparse.add_argument(
     '--version',
     action='store_true',
@@ -297,8 +311,8 @@
 
 try:
     config = utils.get_config(config_file)
-except Exception as e:
-    print(format(e), file=sys.stderr)
+except Exception:
+    print_ex(args.verbose)
     sys.exit(1)
 
 if not os.path.isfile(args.source):
@@ -307,8 +321,8 @@
 
 try:
     utils.check_account_keys(config, args)
-except Exception as e:
-    print(format(e), file=sys.stderr)
+except Exception:
+    print_ex(args.verbose)
     sys.exit(1)
 
 access_key = args.accessKey
@@ -319,8 +333,8 @@
                                            None,
                                            'access_key_id',
                                            '--access-id')
-    except EC2AccountException as e:
-        print(format(e), file=sys.stderr)
+    except EC2AccountException:
+        print_ex(args.verbose)
         sys.exit(1)
 
 if not access_key:
@@ -335,8 +349,8 @@
                                            None,
                                            'secret_access_key',
                                            '--secret-key')
-    except EC2AccountException as e:
-        print(format(e), file=sys.stderr)
+    except EC2AccountException:
+        print_ex(args.verbose)
         sys.exit(1)
 
 if not secret_key:
@@ -413,7 +427,7 @@
                                                    'ami',
                                                    '--ec2-ami')
                 except Exception:
-                    print('Could not determine helper AMI-ID', file=sys.stderr)
+                    print_ex(args.verbose, 'Could not determine helper AMI-ID')
                     sys.exit(1)
             bootkernel = args.akiID
             if args.virtType == 'hvm':
@@ -428,10 +442,8 @@
                                                            'g2_aki_x86_64',
                                                            '--boot-kernel')
                     except Exception:
-                        print(
-                            'Could not find bootkernel in config',
-                            file=sys.stderr
-                        )
+                        print_ex(args.verbose,
+                                 'Could not find bootkernel in config')
                         sys.exit(1)
                 elif args.arch == 'x86_64':
                     try:
@@ -441,10 +453,8 @@
                                                            'aki_x86_64',
                                                            '--boot-kernel')
                     except Exception:
-                        print(
-                            'Could not find bootkernel in config',
-                            file=sys.stderr
-                        )
+                        print_ex(args.verbose,
+                                 'Could not find bootkernel in config')
                         sys.exit(1)
                 elif args.arch == 'i386':
                     try:
@@ -454,10 +464,8 @@
                                                            'aki_i386',
                                                            '--boot-kernel')
                     except Exception:
-                        print(
-                            'Could not find bootkernel in config',
-                            file=sys.stderr
-                        )
+                        print_ex(args.verbose,
+                                 'Could not find bootkernel in config')
                         sys.exit(1)
                 elif args.arch == 'arm64' and args.virtType != 'hvm':
                     print(
@@ -568,7 +576,7 @@
                         msg = 'Not using a subnet-id, none given on the '
                         msg += 'command line and none found in config for '
                         msg += '"subnet_id_%s" value' % region
-                        print(msg)
+                        print_ex(args.verbose, msg)
 
             security_group_ids = args.securityGroupIds
             if not security_group_ids and not args.runningID:
@@ -591,7 +599,7 @@
                             msg = 'No security group specified in the '
                             msg += 'configuration, "security_group_ids_%s" or '
                             msg += 'given on the command line.'
-                            print(msg % region)
+                            print_ex(args.verbose, msg % region)
                     if not security_group_ids and vpc_subnet_id:
                         ec2 = boto3.client(
                             aws_access_key_id=access_key,
@@ -654,11 +662,10 @@
                 else:
                     ami = uploader.create_image(args.source)
                     print('Created image: ', ami)
+        except Exception:
+            print_ex(args.verbose)
         finally:
             setup.clean_up()
-except EC2UploadImgException as e:
-    print(format(e), file=sys.stderr)
-    sys.exit(1)
-except Exception as e:
-    print(format(e), file=sys.stderr)
+except Exception:
+    print_ex(args.verbose)
     sys.exit(1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ec2imgutils-7.0.9/lib/ec2imgutils/VERSION 
new/ec2imgutils-8.0.0/lib/ec2imgutils/VERSION
--- old/ec2imgutils-7.0.9/lib/ec2imgutils/VERSION       2020-03-23 
15:07:21.262538112 +0100
+++ new/ec2imgutils-8.0.0/lib/ec2imgutils/VERSION       2020-05-21 
17:00:19.707235447 +0200
@@ -1 +1 @@
-7.0.9
+8.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ec2imgutils-7.0.9/lib/ec2imgutils/ec2publishimg.py 
new/ec2imgutils-8.0.0/lib/ec2imgutils/ec2publishimg.py
--- old/ec2imgutils-7.0.9/lib/ec2imgutils/ec2publishimg.py      2020-03-23 
15:07:21.262538112 +0100
+++ new/ec2imgutils-8.0.0/lib/ec2imgutils/ec2publishimg.py      2020-05-21 
17:00:19.711235412 +0200
@@ -27,7 +27,7 @@
     def __init__(
             self,
             access_key=None,
-            allow_copy=False,
+            allow_copy='none',
             image_id=None,
             image_name=None,
             image_name_fragment=None,
@@ -38,7 +38,6 @@
         EC2ImgUtils.__init__(self)
 
         self.access_key = access_key
-        self.allow_copy = allow_copy
         self.image_id = image_id
         self.image_name = image_name
         self.image_name_fragment = image_name_fragment
@@ -54,6 +53,11 @@
         else:
             self.publish_msg = '\tShared: %s\t\t%s\t with: %s'
 
+        if allow_copy == 'image':
+            self.allow_copy = self.visibility
+        else:
+            self.allow_copy = allow_copy
+
     # --------------------------------------------------------------------
     def _get_images(self):
         """Return a list of images that match the filter criteria"""
@@ -95,7 +99,7 @@
 
         snapshot_ids = self._get_snapshot_ids_for_image(image)
         for snapshot_id in snapshot_ids:
-            if self.visibility == 'all':
+            if self.allow_copy == 'all':
                 self._connect().modify_snapshot_attribute(
                     SnapshotId=snapshot_id,
                     Attribute='createVolumePermission',
@@ -107,7 +111,7 @@
                     SnapshotId=snapshot_id,
                     Attribute='createVolumePermission',
                     OperationType='add',
-                    UserIds=self.visibility.split(',')
+                    UserIds=self.allow_copy.split(',')
                 )
 
     # --------------------------------------------------------------------
@@ -142,7 +146,7 @@
                     OperationType='add',
                     UserGroups=['all']
                 )
-                if self.allow_copy:
+                if self.allow_copy != 'none':
                     self._share_snapshot(image)
             elif self.visibility == 'none':
                 launch_attributes = self._connect().describe_image_attribute(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ec2imgutils-7.0.9/lib/ec2imgutils/ec2uploadimg.py 
new/ec2imgutils-8.0.0/lib/ec2imgutils/ec2uploadimg.py
--- old/ec2imgutils-7.0.9/lib/ec2imgutils/ec2uploadimg.py       2020-03-23 
15:07:21.262538112 +0100
+++ new/ec2imgutils-8.0.0/lib/ec2imgutils/ec2uploadimg.py       2020-05-21 
17:00:19.711235412 +0200
@@ -632,7 +632,15 @@
     # ---------------------------------------------------------------------
     def _find_device_name(self, device_size):
         """Match an attached volume by size"""
-        lsblk_out = json.loads(self._execute_ssh_command('lsblk -a -J'))
+        try:
+            lsblk_out = json.loads(self._execute_ssh_command('lsblk -a -J'))
+        except Exception:
+            print(
+                '"lsblk -a -J" command failed on helper instance. Ensure the '
+                'helper instance has lsblk >= 2.27 which has the json option.'
+            )
+            lsblk_out = {'blockdevices': tuple()}
+
         for device in lsblk_out['blockdevices']:
             if device.get('children'):
                 continue
@@ -744,6 +752,17 @@
                         'SubnetId': self.vpc_subnet_id,
                         'Groups': self.security_group_ids.split(',')
                     }
+                ],
+                TagSpecifications=[
+                    {
+                        'ResourceType': 'instance',
+                        'Tags': [
+                            {
+                                'Key': 'Name',
+                                'Value': 'ec2uploadimg-helper-instance'
+                            }
+                        ]
+                    }
                 ]
             )['Instances'][0]
         else:
@@ -760,6 +779,17 @@
                         'AssociatePublicIpAddress': not self.use_private_ip,
                         'SubnetId': self.vpc_subnet_id
                     }
+                ],
+                TagSpecifications=[
+                    {
+                        'ResourceType': 'instance',
+                        'Tags': [
+                            {
+                                'Key': 'Name',
+                                'Value': 'ec2uploadimg-helper-instance'
+                            }
+                        ]
+                    }
                 ]
             )['Instances'][0]
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ec2imgutils-7.0.9/man/man1/ec2publishimg.1 
new/ec2imgutils-8.0.0/man/man1/ec2publishimg.1
--- old/ec2imgutils-7.0.9/man/man1/ec2publishimg.1      2020-03-23 
15:07:21.262538112 +0100
+++ new/ec2imgutils-8.0.0/man/man1/ec2publishimg.1      2020-05-21 
17:00:19.711235412 +0200
@@ -30,9 +30,14 @@
 .I access_key_id
 in the configuration file.
 .IP "--allow-copy"
-Flag to enable the account(s) with which the image is shared to copy the image
-by allowing copy access to the underlying snapshot. The default behavior is
-to disallow copying of the image.
+Set the image copy permissions. The option supports the keyword
+.I image
+to allow those that the image is shared with to copy it; the keyword
+.I none
+which does not allow copy access and is the default behavior. The option
+allows the specification of an AWS account number or a comma separated list
+with no white space to specify multiple account numbers to allow those
+accounts to copy the image.
 .IP "-n --dry-run"
 The program will not perform any action. It will provide information on
 .I stdout
@@ -94,7 +99,7 @@
 .I all
 to set the image to public, the keyword
 .I none
-to set the image private, or expects an AWS account number to share the image
+to set the image private, or expects a AWS account number to share the image
 with a specific account. Use a comma separated list with no white space to
 specify multiple account numbers. By default the selected image will be
 published, i.e.


Reply via email to