- run_command: fix Python 3 encoding issue (bsc#1082871)
- fence_gce: use default credentials from googleapiclient - fence_gce: fix regression - missing import oauth2client.client - fence_gce: fix regression - missing import googleapiclient.discovery - Add 0002-fence_gce-fix-regression-missing-import-googleapicli.patch - Add 0003-fence_gce-fix-regression-missing-import-oauth2client.patch - Add 0004-fence_gce-use-default-credentials-from-googleapiclie.patch - Add 0005-run_command-fix-Python-3-encoding-issue.patch OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/fence-agents?expand=0&rev=87
This commit is contained in:
parent
dcb700386a
commit
49a513e01e
@ -0,0 +1,28 @@
|
||||
From e22d41504ee53e5a4a72009581d4d69e9ae7447b Mon Sep 17 00:00:00 2001
|
||||
From: Helen Koike <helen.koike@collabora.com>
|
||||
Date: Fri, 20 Apr 2018 01:59:38 -0300
|
||||
Subject: [PATCH 2/5] fence_gce: fix regression - missing import
|
||||
googleapiclient.discovery
|
||||
|
||||
import googleapiclient.discovery was missing
|
||||
import googleapiclient is not required
|
||||
---
|
||||
fence/agents/gce/fence_gce.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fence/agents/gce/fence_gce.py b/fence/agents/gce/fence_gce.py
|
||||
index c1f8b16f..04d59846 100644
|
||||
--- a/fence/agents/gce/fence_gce.py
|
||||
+++ b/fence/agents/gce/fence_gce.py
|
||||
@@ -4,7 +4,7 @@ import atexit
|
||||
import sys
|
||||
sys.path.append("@FENCEAGENTSLIBDIR@")
|
||||
|
||||
-import googleapiclient
|
||||
+import googleapiclient.discovery
|
||||
import oauth2client
|
||||
from fencing import fail_usage, run_delay, all_opt, atexit_handler, check_input, process_input, show_docs, fence_action
|
||||
|
||||
--
|
||||
2.16.3
|
||||
|
@ -0,0 +1,38 @@
|
||||
From ba8169f4ef2d715ed681ae38f599aa544fa00023 Mon Sep 17 00:00:00 2001
|
||||
From: Helen Koike <helen.koike@collabora.com>
|
||||
Date: Tue, 1 May 2018 14:01:20 -0300
|
||||
Subject: [PATCH 3/5] fence_gce: fix regression - missing import
|
||||
oauth2client.client
|
||||
|
||||
import oauth2client.client was missing
|
||||
import oauth2client is not necessary
|
||||
Fix wrong path to GoogleCredentials
|
||||
---
|
||||
fence/agents/gce/fence_gce.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/fence/agents/gce/fence_gce.py b/fence/agents/gce/fence_gce.py
|
||||
index 04d59846..3a614f14 100644
|
||||
--- a/fence/agents/gce/fence_gce.py
|
||||
+++ b/fence/agents/gce/fence_gce.py
|
||||
@@ -5,7 +5,7 @@ import sys
|
||||
sys.path.append("@FENCEAGENTSLIBDIR@")
|
||||
|
||||
import googleapiclient.discovery
|
||||
-import oauth2client
|
||||
+import oauth2client.client
|
||||
from fencing import fail_usage, run_delay, all_opt, atexit_handler, check_input, process_input, show_docs, fence_action
|
||||
|
||||
def translate_status(instance_status):
|
||||
@@ -99,7 +99,7 @@ def main():
|
||||
run_delay(options)
|
||||
|
||||
try:
|
||||
- credentials = oauth2client.GoogleCredentials.get_application_default()
|
||||
+ credentials = oauth2client.client.GoogleCredentials.get_application_default()
|
||||
conn = googleapiclient.discovery.build('compute', 'v1', credentials=credentials)
|
||||
except Exception as err:
|
||||
fail_usage("Failed: Create GCE compute v1 connection: {}".format(str(err)))
|
||||
--
|
||||
2.16.3
|
||||
|
@ -0,0 +1,43 @@
|
||||
From f94bc0bb6058fe791d597ed8aa5f60f9410debdb Mon Sep 17 00:00:00 2001
|
||||
From: Helen Koike <helen.koike@collabora.com>
|
||||
Date: Fri, 27 Apr 2018 13:51:40 -0300
|
||||
Subject: [PATCH 4/5] fence_gce: use default credentials from googleapiclient
|
||||
|
||||
There are two ways for performing credentials
|
||||
1) google-auth
|
||||
2) oauth2client (deprecated)
|
||||
googleapiclient check which libraries are present in the system and use
|
||||
the most apropriated one in the order above.
|
||||
|
||||
Also keep compatibility with previous version of googleapiclient library
|
||||
---
|
||||
fence/agents/gce/fence_gce.py | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/fence/agents/gce/fence_gce.py b/fence/agents/gce/fence_gce.py
|
||||
index 3a614f14..3abb5207 100644
|
||||
--- a/fence/agents/gce/fence_gce.py
|
||||
+++ b/fence/agents/gce/fence_gce.py
|
||||
@@ -5,7 +5,6 @@ import sys
|
||||
sys.path.append("@FENCEAGENTSLIBDIR@")
|
||||
|
||||
import googleapiclient.discovery
|
||||
-import oauth2client.client
|
||||
from fencing import fail_usage, run_delay, all_opt, atexit_handler, check_input, process_input, show_docs, fence_action
|
||||
|
||||
def translate_status(instance_status):
|
||||
@@ -99,7 +98,10 @@ def main():
|
||||
run_delay(options)
|
||||
|
||||
try:
|
||||
- credentials = oauth2client.client.GoogleCredentials.get_application_default()
|
||||
+ credentials = None
|
||||
+ if tuple(googleapiclient.__version__) < tuple("1.6.0"):
|
||||
+ import oauth2client.client
|
||||
+ credentials = oauth2client.client.GoogleCredentials.get_application_default()
|
||||
conn = googleapiclient.discovery.build('compute', 'v1', credentials=credentials)
|
||||
except Exception as err:
|
||||
fail_usage("Failed: Create GCE compute v1 connection: {}".format(str(err)))
|
||||
--
|
||||
2.16.3
|
||||
|
27
0005-run_command-fix-Python-3-encoding-issue.patch
Normal file
27
0005-run_command-fix-Python-3-encoding-issue.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From b587642048b9f75cdc08d4d9e3fa03f14811cc21 Mon Sep 17 00:00:00 2001
|
||||
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||
Date: Fri, 20 Apr 2018 15:16:42 +0200
|
||||
Subject: [PATCH 5/5] run_command: fix Python 3 encoding issue
|
||||
|
||||
---
|
||||
fence/agents/lib/fencing.py.py | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
|
||||
index 5b38460e..15914f0f 100644
|
||||
--- a/fence/agents/lib/fencing.py.py
|
||||
+++ b/fence/agents/lib/fencing.py.py
|
||||
@@ -995,7 +995,9 @@ def run_command(options, command, timeout=None, env=None, log_command=None):
|
||||
logging.info("Executing: %s\n", log_command or command)
|
||||
|
||||
try:
|
||||
- process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
|
||||
+ process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env,
|
||||
+ # decodes newlines and in python3 also converts bytes to str
|
||||
+ universal_newlines=(sys.version_info[0] > 2))
|
||||
except OSError:
|
||||
fail_usage("Unable to run %s\n" % command)
|
||||
|
||||
--
|
||||
2.16.3
|
||||
|
@ -1,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu May 17 16:19:11 UTC 2018 - kgronlund@suse.com
|
||||
|
||||
- run_command: fix Python 3 encoding issue (bsc#1082871)
|
||||
- fence_gce: use default credentials from googleapiclient
|
||||
- fence_gce: fix regression - missing import oauth2client.client
|
||||
- fence_gce: fix regression - missing import googleapiclient.discovery
|
||||
- Add 0002-fence_gce-fix-regression-missing-import-googleapicli.patch
|
||||
- Add 0003-fence_gce-fix-regression-missing-import-oauth2client.patch
|
||||
- Add 0004-fence_gce-use-default-credentials-from-googleapiclie.patch
|
||||
- Add 0005-run_command-fix-Python-3-encoding-issue.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 26 05:37:33 UTC 2018 - kgronlund@suse.com
|
||||
|
||||
|
@ -32,6 +32,14 @@ Release: 0
|
||||
Url: https://github.com/ClusterLabs/fence-agents
|
||||
Source0: %{name}-%{version}.tar.xz
|
||||
Patch1: 0001-Use-Python-3-for-all-scripts-bsc-1065966.patch
|
||||
# fence_gce: fix regression - missing import googleapiclient.discovery
|
||||
Patch2: 0002-fence_gce-fix-regression-missing-import-googleapicli.patch
|
||||
# fence_gce: fix regression - missing import oauth2client.client
|
||||
Patch3: 0003-fence_gce-fix-regression-missing-import-oauth2client.patch
|
||||
# fence_gce: use default credentials from googleapiclient
|
||||
Patch4: 0004-fence_gce-use-default-credentials-from-googleapiclie.patch
|
||||
# run_command: fix Python 3 encoding issue (bsc#1082871)
|
||||
Patch5: 0005-run_command-fix-Python-3-encoding-issue.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: autoconf
|
||||
@ -103,6 +111,10 @@ development.
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
|
||||
%build
|
||||
CFLAGS="${CFLAGS} ${RPM_OPT_FLAGS}"
|
||||
|
Loading…
Reference in New Issue
Block a user