Hello community,
here is the log from the commit of package python3-gcemetadata for
openSUSE:Factory checked in at 2019-06-14 20:42:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-gcemetadata (Old)
and /work/SRC/openSUSE:Factory/.python3-gcemetadata.new.4811 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-gcemetadata"
Fri Jun 14 20:42:14 2019 rev:3 rq:709589 version:1.0.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-gcemetadata/python3-gcemetadata.changes
2018-07-31 15:59:50.887592109 +0200
+++
/work/SRC/openSUSE:Factory/.python3-gcemetadata.new.4811/python3-gcemetadata.changes
2019-06-14 20:42:15.646407059 +0200
@@ -1,0 +2,11 @@
+Wed Jun 5 22:01:52 UTC 2019 - Robert Schweikert <[email protected]>
+
+- Update to version 1.0.3 (bsc#1134510)
+ + Handle the condition where the identity data of the instance may
+ not be accessible from the metadata server and provide proper
+ error messaging
+- From 1.0.2
+ + Avoid traceback when not running in GCE, by testing access to the
+ metdata server first before performing othre operations
+
+-------------------------------------------------------------------
Old:
----
gcemetadata-1.0.1.tar.bz2
New:
----
gcemetadata-1.0.3.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python3-gcemetadata.spec ++++++
--- /var/tmp/diff_new_pack.a5ipWI/_old 2019-06-14 20:42:16.206406109 +0200
+++ /var/tmp/diff_new_pack.a5ipWI/_new 2019-06-14 20:42:16.206406109 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python3-gcemetadata
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,13 +12,13 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define upstream_name gcemetadata
Name: python3-gcemetadata
-Version: 1.0.1
+Version: 1.0.3
Release: 0
Summary: Python module for collecting instance metadata from GCE
License: GPL-3.0-or-later
++++++ gcemetadata-1.0.1.tar.bz2 -> gcemetadata-1.0.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gcemetadata-1.0.1/gcemetadata
new/gcemetadata-1.0.3/gcemetadata
--- old/gcemetadata-1.0.1/gcemetadata 2018-06-19 22:02:02.131563393 +0200
+++ new/gcemetadata-1.0.3/gcemetadata 2019-06-05 21:14:27.034117541 +0200
@@ -17,13 +17,12 @@
import getopt
-import os
import sys
import gcemetadata.gcemetadata as gcemetadata
import gcemetadata.gcemetautils as gcemetautils
-from gcemetadata.gcemetaExceptions import *
+from gcemetadata.gcemetaExceptions import GCEMetadataException
general_options = ['api', 'help', 'identity-format=', 'listapis', 'output=',
'version', 'xml']
@@ -115,13 +114,13 @@
if api:
try:
meta = gcemetadata.GCEMetadata(api)
- except gcemetadata.GCEMetadataException as e:
+ except GCEMetadataException as e:
print(e, file=sys.stderr)
sys.exit(1)
else:
try:
meta = gcemetadata.GCEMetadata()
- except gcemetadata.GCEMetadataException as e:
+ except GCEMetadataException as e:
print(e, file=sys.stderr)
sys.exit(1)
@@ -138,6 +137,28 @@
if opt in opts_with_args:
opt += '='
command_line_opts.append(opt)
+ # Special case for identity handling
+ # It is possible to have an instance that does not support access to
+ # the guest-attributes information from the metadata server. If this
+ # is the case the logically linked options of "identity-format" and
+ # "identity" cannot be handled properly as the "identity" option gets
+ # removed from the processed command line options. This leads to
+ # "identity-format" having the wrong value and triggering an
+ # incorrect message (Issue #2).
+ # This is the only place in the code where we know about
+ # the connection between the two options.
+ # Raising an error at a lower level would break the best effort
+ # nature of the command. One can still retrieve metadata
+ # on an instance that does not afford access to the guest-attributes
+ if (
+ '--identity-format' in sys.argv[1:] and
+ 'identity' not in command_line_opts
+ ):
+ print(
+ 'Unable to access instance identity information',
+ file=sys.stderr
+ )
+ sys.exit(1)
opts, args = getopt.gnu_getopt(
sys.argv[1:],
'hlo:vq:x',
@@ -188,7 +209,7 @@
elif opt == '--diskid':
try:
meta.set_disk_device(val)
- except gcemetadata.GCEMetadataException as e:
+ except GCEMetadataException as e:
usage(meta.get_api_map(), meta.get_option_categories(), e)
continue
elif opt == '--identity':
@@ -207,13 +228,13 @@
elif opt == '--licenseid':
try:
meta.set_license_id(val)
- except gcemetadata.GCEMetadataException as e:
+ except GCEMetadataException as e:
usage(meta.get_api_map(), meta.get_option_categories(), e)
continue
elif opt == '--netid':
try:
meta.set_net_device(val)
- except gcemetadata.GCEMetadataException as e:
+ except GCEMetadataException as e:
usage(meta.get_api_map(), meta.get_option_categories(), e)
continue
elif opt in ('-o', '--output'):
@@ -223,13 +244,13 @@
found_query = 1
try:
meta.set_data_category(val)
- except gcemetadata.GCEMetadataException as e:
+ except GCEMetadataException as e:
usage(meta.get_api_map(), meta.get_option_categories(), e)
continue
elif opt == '--subnetid':
try:
meta.set_subnet(val)
- except gcemetadata.GCEMetadataException as e:
+ except GCEMetadataException as e:
usage(meta.get_api_map(), meta.get_option_categories(), e)
continue
elif opt in ('-v', '--version'):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gcemetadata-1.0.1/lib/gcemetadata/VERSION
new/gcemetadata-1.0.3/lib/gcemetadata/VERSION
--- old/gcemetadata-1.0.1/lib/gcemetadata/VERSION 2018-06-19
22:02:02.131563393 +0200
+++ new/gcemetadata-1.0.3/lib/gcemetadata/VERSION 2019-06-05
21:14:27.030117581 +0200
@@ -1 +1 @@
-1.0.1
+1.0.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gcemetadata-1.0.1/lib/gcemetadata/gcemetadata.py
new/gcemetadata-1.0.3/lib/gcemetadata/gcemetadata.py
--- old/gcemetadata-1.0.1/lib/gcemetadata/gcemetadata.py 2018-06-19
22:02:02.131563393 +0200
+++ new/gcemetadata-1.0.3/lib/gcemetadata/gcemetadata.py 2019-06-05
21:14:27.030117581 +0200
@@ -20,7 +20,7 @@
import time
import urllib.request, urllib.error, urllib.parse
-from gcemetadata.gcemetaExceptions import *
+from gcemetadata.gcemetaExceptions import GCEMetadataException
class GCEMetadata:
@@ -52,14 +52,14 @@
self.server = 'metadata.google.internal'
self.subnet_id = -1
- if apiv not in self.get_available_api_versions():
- msg = 'Given API version "%s" not available' % apiv
- raise GCEMetadataException(msg)
-
if not self._test_connectivity(self.server, 80):
msg = 'Could not connect to: %s' % self.server
raise GCEMetadataException(msg)
+ if apiv not in self.get_available_api_versions():
+ msg = 'Given API version "%s" not available' % apiv
+ raise GCEMetadataException(msg)
+
self._create_options_map()
def _test_connectivity(self, addr, port):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gcemetadata-1.0.1/lib/gcemetadata/gcemetautils.py
new/gcemetadata-1.0.3/lib/gcemetadata/gcemetautils.py
--- old/gcemetadata-1.0.1/lib/gcemetadata/gcemetautils.py 2018-06-19
22:02:02.131563393 +0200
+++ new/gcemetadata-1.0.3/lib/gcemetadata/gcemetautils.py 2019-06-05
21:14:27.030117581 +0200
@@ -25,7 +25,7 @@
from io import IOBase
import gcemetadata
-from gcemetadata.gcemetaExceptions import *
+from gcemetadata.gcemetaExceptions import GCEMetadataException
def _clean_up_options(metadata, options):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gcemetadata-1.0.1/setup.py
new/gcemetadata-1.0.3/setup.py
--- old/gcemetadata-1.0.1/setup.py 2018-06-19 22:02:02.131563393 +0200
+++ new/gcemetadata-1.0.3/setup.py 2019-06-05 21:14:27.034117541 +0200
@@ -1,7 +1,7 @@
#!/usr/bin/env python
"""Setup module for gcemetadata"""
-# Copyright (c) 2015 SUSE LLC
+# Copyright (c) 2018 SUSE LLC
#
# This file is part of gcemetadata.
#