-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# inspired from tophat/bin/uploadcredential.py
#
# so the defaults below are of no real importance
# this for now points at demo.myslice.info, but sounds like a
# better default for the long run
-DEFAULT_URL = "http://myslice.onelab.eu:7080"
-DEFAULT_PLATFORM = 'ple'
+import getpass
-# starting with 2.7.9 we need to turn off server verification
-import ssl
-try:
- turn_off_server_verify = {'context': ssl._create_unverified_context()}
-except:
- turn_off_server_verify = {}
+import xmlrpc.client
-import getpass
+from sfa.util.ssl import simple_ssl_context
-from sfa.util.py23 import xmlrpc_client
+DEFAULT_URL = "http://myslice.onelab.eu:7080"
+DEFAULT_PLATFORM = 'ple'
class ManifoldUploader:
def username(self):
if not self._username:
- self._username = raw_input("Enter your manifold username: ")
+ self._username = input("Enter your manifold username: ")
return self._username
def password(self):
def platform(self):
if not self._platform:
- self._platform = raw_input(
+ self._platform = input(
"Enter your manifold platform [%s]: " % DEFAULT_PLATFORM)
if self._platform.strip() == "":
self._platform = DEFAULT_PLATFORM
def url(self):
if not self._url:
- self._url = raw_input(
+ self._url = input(
"Enter the URL for your manifold API [%s]: " % DEFAULT_URL)
if self._url.strip() == "":
self._url = DEFAULT_URL
# won't be happy with several calls issued in the same session
# so we do not cache this one
def proxy(self):
- # if not self._proxy:
- # url=self.url()
- # self.logger.info("Connecting manifold url %s"%url)
- # self._proxy = xmlrpc_client.ServerProxy(url, allow_none = True)
- # return self._proxy
url = self.url()
self.logger.debug("Connecting manifold url %s" % url)
- proxy = xmlrpc_client.ServerProxy(url, allow_none=True,
- **turn_off_server_verify)
-
- return proxy
+ return xmlrpc.client.ServerProxy(url, allow_none=True,
+ context=simple_ssl_context())
# does the job for one credential
# expects the credential (string) and an optional message (e.g. hrn) for reporting
self.logger.info(" V2 Update returned code %s and error >>%s<<" % (
retcod2['code'], retcod2['description']))
self.logger.debug("****** full retcod2")
- for k, v in retcod2.items():
+ for k, v in list(retcod2.items()):
self.logger.debug("**** %s: %s" % (k, v))
return False
except Exception as e: