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 2023-08-31 13:46:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-ec2metadata (Old)
and /work/SRC/openSUSE:Factory/.python3-ec2metadata.new.1766 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-ec2metadata"
Thu Aug 31 13:46:06 2023 rev:4 rq:1108194 version:5.0.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-ec2metadata/python3-ec2metadata.changes 2022-10-18 12:45:48.393833930 +0200
+++ /work/SRC/openSUSE:Factory/.python3-ec2metadata.new.1766/python3-ec2metadata.changes 2023-08-31 13:52:12.090127453 +0200
@@ -1,0 +2,11 @@
+Wed Aug 23 21:26:04 UTC 2023 - Robert Schweikert
+
+- Update to version 5.0.0 (bsc#1214215)
+ + Remove the --use-token command line option. Aws is deprecating access
+ to instance metadata without authentication token. Ability to access
+ metadat without token has been removed
+ + Support access to the metadata server over IPv6. If the customer
+ enables the IPv6 endpoint for an instance it will be preferred over the
+ IPv4 endpoint
+
+-------------------------------------------------------------------
Old:
----
ec2metadata-4.0.0.tar.bz2
New:
----
ec2metadata-5.0.0.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python3-ec2metadata.spec ++++++
--- /var/tmp/diff_new_pack.CJ78PL/_old 2023-08-31 13:52:13.062162196 +0200
+++ /var/tmp/diff_new_pack.CJ78PL/_new 2023-08-31 13:52:13.066162338 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python3-ec2metadata
#
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 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: 4.0.0
+Version: 5.0.0
Release: 0
Summary: Collect instance metadata in EC2
License: GPL-3.0-or-later
++++++ ec2metadata-4.0.0.tar.bz2 -> ec2metadata-5.0.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ec2metadata-4.0.0/ec2metadata new/ec2metadata-5.0.0/ec2metadata
--- old/ec2metadata-4.0.0/ec2metadata 2022-10-10 22:51:55.448845562 +0200
+++ new/ec2metadata-5.0.0/ec2metadata 2023-08-23 23:25:51.057552629 +0200
@@ -68,7 +68,6 @@
getopt_metaopts.append('help')
getopt_metaopts.append('listapis')
getopt_metaopts.append('output')
- getopt_metaopts.append('use-token-access')
getopt_metaopts.append('version')
getopt_metaopts.append('xml')
getopt_metaopts.sort()
@@ -105,9 +104,6 @@
elif opt in ('-x', '--xml'):
generate_xml = True
continue
- elif opt == '--use-token-access':
- meta.use_token_access()
- continue
metaopts.append(opt.replace('--', ''))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ec2metadata-4.0.0/lib/ec2metadata/VERSION new/ec2metadata-5.0.0/lib/ec2metadata/VERSION
--- old/ec2metadata-4.0.0/lib/ec2metadata/VERSION 2022-10-10 22:51:55.444845583 +0200
+++ new/ec2metadata-5.0.0/lib/ec2metadata/VERSION 2023-08-23 23:25:51.057552629 +0200
@@ -1 +1 @@
-4.0.0
+5.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ec2metadata-4.0.0/lib/ec2metadata/__init__.py new/ec2metadata-5.0.0/lib/ec2metadata/__init__.py
--- old/ec2metadata-4.0.0/lib/ec2metadata/__init__.py 2022-10-10 22:51:55.444845583 +0200
+++ new/ec2metadata-5.0.0/lib/ec2metadata/__init__.py 2023-08-23 23:25:51.057552629 +0200
@@ -1,5 +1,5 @@
# Copyright (c) 2013 Alon Swartz
-# Copyright (c) 2019 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
#
# This file is part of ec2metadata.
#
@@ -20,7 +20,8 @@
import urllib.request
import urllib.parse
import urllib.error
-import socket
+
+from socket import (has_ipv6, create_connection)
class EC2MetadataError(Exception):
@@ -30,33 +31,22 @@
class EC2Metadata:
"""Class for querying metadata from EC2"""
- def __init__(self, addr='169.254.169.254', api='2008-02-01'):
- self.addr = addr
+ def __init__(self, api='2008-02-01'):
self.api = api
self.data_categories = ['dynamic/', 'meta-data/']
self.duplicate_names = []
+
+ self.addr = None
+ self._set_ipaddress()
- if not self._test_connectivity(self.addr, 80):
- msg = 'Could not establish connection to: %s' % self.addr
+ if not self.addr:
+ msg = 'Could not establish connection to: IMDS'
raise EC2MetadataError(msg)
self._set_api_header()
self._reset_meta_options_api_map()
self._set_meta_options()
- @staticmethod
- def _test_connectivity(addr, port):
- for i in range(6):
- s = socket.socket()
- try:
- s.connect((addr, port))
- s.close()
- return True
- except socket.error:
- time.sleep(1)
-
- return False
-
def _add_meta_option(self, path):
"""Add meta options available under the current path to the options
to API map"""
@@ -119,20 +109,48 @@
}
def _set_api_header(self):
- """Set the header to be used in requests to the metadata service,
- IMDs. Prefer IMDSv2 which requires a token."""
+ """Set the header to be used in requests to the metadata service"""
request = urllib.request.Request(
- 'http://169.254.169.254/latest/api/token',
+ 'http://%s/latest/api/token' % self.addr,
headers={'X-aws-ec2-metadata-token-ttl-seconds': '21600'},
method='PUT'
)
try:
token = urllib.request.urlopen(request).read().decode()
except urllib.error.URLError:
- self.request_header = {}
+ raise EC2MetadataError('Unable to retrieve metadata token')
self.request_header = {'X-aws-ec2-metadata-token': token}
-
+
+ def _set_ipaddress(self):
+ metadata_ip_addrs = {
+ 'ipv6_addr': 'fd00:ec2::254',
+ 'ipv4_addr': '169.254.169.254'
+ }
+ # Check if the Python implementation has IPv6 support in the first place
+ if not has_ipv6:
+ self.addr = metadata_ip_addrs.get('ipv4_addr')
+ return
+
+ # Python keeps the order in which entries were added to a dictionary
+ # therefore we comply with the RFC and try IPv6 first
+ for ip_family, ip_addr in metadata_ip_addrs.items():
+ for i in range(3):
+ try:
+ socket = create_connection((ip_addr, 80), timeout=1)
+ socket.close()
+ if ip_family == 'ipv6_addr':
+ # Make the IPv6 address http friendly
+ self.addr = '[%s]' % ip_addr
+ else:
+ self.addr = ip_addr
+ except OSError:
+ # Cannot reach the network
+ break
+ except TimeoutError:
+ # Not ready yet wait a little bit
+ time.sleep(1)
+
def _set_meta_options(self):
"""Set the metadata options for the current API on this object."""
for path in self.data_categories:
@@ -189,7 +207,3 @@
self._reset_meta_options_api_map()
self._set_meta_options()
- def use_token_access(self):
- """Use token based access to retrieve the metadata information. This
- supports IMDSv2"""
- self.token_access = True