Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python3-ec2metadata for 
openSUSE:Factory checked in at 2022-10-18 12:45:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-ec2metadata (Old)
 and      /work/SRC/openSUSE:Factory/.python3-ec2metadata.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python3-ec2metadata"

Tue Oct 18 12:45:23 2022 rev:3 rq:1029610 version:4.0.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-ec2metadata/python3-ec2metadata.changes  
2020-08-04 20:23:13.061007757 +0200
+++ 
/work/SRC/openSUSE:Factory/.python3-ec2metadata.new.2275/python3-ec2metadata.changes
        2022-10-18 12:45:48.393833930 +0200
@@ -1,0 +2,9 @@
+Mon Oct 10 20:52:54 UTC 2022 - Robert Schweikert <rjsch...@suse.com>
+
+- Update to version 4.0.0 (bsc#1204066)
+  + Disambiguate cli options for duplicate endpoints. This is an
+    incompatible change for some API versions of IMDS. When a duplicate
+    endpoint is detected the cli option for both endpoints is expanded to a
+    unique name.
+
+-------------------------------------------------------------------

Old:
----
  ec2metadata-3.0.3.tar.bz2

New:
----
  ec2metadata-4.0.0.tar.bz2

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

Other differences:
------------------
++++++ python3-ec2metadata.spec ++++++
--- /var/tmp/diff_new_pack.jhGeuy/_old  2022-10-18 12:45:48.893835068 +0200
+++ /var/tmp/diff_new_pack.jhGeuy/_new  2022-10-18 12:45:48.897835077 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python3-ec2metadata
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %define upstream_name ec2metadata
 Name:           python3-ec2metadata
-Version:        3.0.3
+Version:        4.0.0
 Release:        0
 Summary:        Collect instance metadata in EC2
 License:        GPL-3.0-or-later

++++++ ec2metadata-3.0.3.tar.bz2 -> ec2metadata-4.0.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ec2metadata-3.0.3/lib/ec2metadata/VERSION 
new/ec2metadata-4.0.0/lib/ec2metadata/VERSION
--- old/ec2metadata-3.0.3/lib/ec2metadata/VERSION       2020-08-03 
20:29:28.212509248 +0200
+++ new/ec2metadata-4.0.0/lib/ec2metadata/VERSION       2022-10-10 
22:51:55.444845583 +0200
@@ -1 +1 @@
-3.0.3
+4.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ec2metadata-3.0.3/lib/ec2metadata/__init__.py 
new/ec2metadata-4.0.0/lib/ec2metadata/__init__.py
--- old/ec2metadata-3.0.3/lib/ec2metadata/__init__.py   2020-08-03 
20:29:28.212509248 +0200
+++ new/ec2metadata-4.0.0/lib/ec2metadata/__init__.py   2022-10-10 
22:51:55.444845583 +0200
@@ -34,6 +34,7 @@
         self.addr = addr
         self.api = api
         self.data_categories = ['dynamic/', 'meta-data/']
+        self.duplicate_names = []
 
         if not self._test_connectivity(self.addr, 80):
             msg = 'Could not establish connection to: %s' % self.addr
@@ -56,7 +57,7 @@
 
         return False
 
-    def _add_mata_option(self, path):
+    def _add_meta_option(self, path):
         """Add meta options available under the current path to the options
            to API map"""
         options = list(self.meta_options_api_map.keys())
@@ -68,11 +69,35 @@
             if item:
                 if item == 'public-keys/':
                     continue
-                if item not in options:
-                    if item[-1] != '/':
+                if item[-1] == '/':
+                    self._add_meta_option(path+item)
+                else:
+                    if item not in options and item not in 
self.duplicate_names:
                         self.meta_options_api_map[item] = path + item
                     else:
-                        self._add_mata_option(path+item)
+                        if item in options:
+                            # Expand the existing entry
+                            self.duplicate_names.append(item)
+                            existing_path = self.meta_options_api_map[item]
+                            new_name = self._expand_name(existing_path)
+                            self.meta_options_api_map[new_name] = existing_path
+                            del(self.meta_options_api_map[item])
+                        # Construct a new name for the option using the given
+                        # path as name addition
+                        option_name = self._expand_name(path, item)
+                        self.meta_options_api_map[option_name] = path + item
+
+    def _expand_name(self, path, endpoint=''):
+        """Expand the name of an endpoint with the preceeding entry in the
+           path or construct the name from the path by using the last to
+           elements"""
+        path_elements = path.split('/')
+        if not path_elements[-1]:
+            path_elements = path_elements[:-1]
+        if endpoint:
+            return path_elements[-1] + '-' + endpoint
+
+        return '-'.join(path_elements[-2:])
 
     def _get(self, uri):
         url = 'http://%s/%s/%s' % (self.addr, self.api, uri)
@@ -111,7 +136,7 @@
     def _set_meta_options(self):
         """Set the metadata options for the current API on this object."""
         for path in self.data_categories:
-            self._add_mata_option(path)
+            self._add_meta_option(path)
 
     def get(self, metaopt):
         """Return value of metaopt"""

Reply via email to