From c1cf17d278424109501f64fbe04f97c1eeef2cb9 Mon Sep 17 00:00:00 2001 From: fbarreir Date: Thu, 21 Nov 2019 11:18:01 +0100 Subject: [PATCH] k8s: replaced leftover requests call --- pandaharvester/harvestercloud/k8s_startup_script.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pandaharvester/harvestercloud/k8s_startup_script.py b/pandaharvester/harvestercloud/k8s_startup_script.py index 52fbeae3..e96546ff 100644 --- a/pandaharvester/harvestercloud/k8s_startup_script.py +++ b/pandaharvester/harvestercloud/k8s_startup_script.py @@ -21,6 +21,7 @@ import mimetypes import ssl import urlparse +import urllib2 logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', filename='/tmp/vm_script.log', filemode='w') @@ -96,14 +97,11 @@ def upload_logs(url, log_file_name, destination_name, proxy_cert): def get_url(url, headers=None): """ get content from specified URL + TODO: error handling """ - reply = requests.get(url, headers=headers) - if reply.status_code != 200: - logging.debug('[get_attribute] Failed to open {0}'.format(url)) - return None - else: - return reply.content - + response = urllib2.urlopen(wrapper_url) + content = response.read() + return content def get_configuration():