Mercurial > repos > yating-l > jbrowsehubtoapollo
changeset 2:8ff4b84d709f draft
planemo upload for repository https://github.com/Yating-L/jbrowsehub-to-apollo.git commit 324276a31f1d9e410c37d4514ad9432ba6051e35-dirty
author | yating-l |
---|---|
date | Wed, 25 Oct 2017 12:41:34 -0400 |
parents | 2ae1e96a8380 |
children | 6f262a92e8dc |
files | apollo/ApolloInstance.py util/subtools.py |
diffstat | 2 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/apollo/ApolloInstance.py Tue Oct 24 18:24:40 2017 -0400 +++ b/apollo/ApolloInstance.py Wed Oct 25 12:41:34 2017 -0400 @@ -21,7 +21,7 @@ def _arrow_init(self): - subtools.verify_user_login(self.apollo_admin.user_email, self.apollo_admin.password) + subtools.verify_user_login(self.apollo_admin.user_email, self.apollo_admin.password, self.apollo_host) arrow_config = tempfile.NamedTemporaryFile(bufsize=0) with open(arrow_config.name, 'w') as conf: htmlMakoRendered = self.apolloTemplate.render( @@ -56,7 +56,7 @@ user_id = user_info.get('userId') if not user_id: self.logger.debug("Cannot create new user: %s; The user may already exist", apollo_user.user_email) - subtools.verify_user_login(apollo_user.user_email, apollo_user.password) + subtools.verify_user_login(apollo_user.user_email, apollo_user.password, self.apollo_host) user_id = subtools.arrow_get_users(apollo_user.user_email) self.logger.debug("Got user_id for new or existing user: user_id = %s", str(user_id)) return user_id
--- a/util/subtools.py Tue Oct 24 18:24:40 2017 -0400 +++ b/util/subtools.py Wed Oct 25 12:41:34 2017 -0400 @@ -63,7 +63,6 @@ # If we detect an error from the subprocess, then we raise an exception # TODO: Manage if we raise an exception for everything, or use CRITICAL etc... but not stop process # TODO: The responsability of returning a sys.exit() should not be there, but up in the app. - #if p.returncode: if p.returncode: if stderr == subprocess.PIPE: raise PopenError(cmd, error, p.returncode) @@ -143,14 +142,14 @@ return d['userId'] logging.error("Cannot find user %s", user_email) -def verify_user_login(username, password): +def verify_user_login(username, password, apollo_host): user_info = {'username': username, 'password': password} array_call = ['curl', '-b', 'cookies.txt', '-c', 'cookies.txt', '-H', 'Content-Type:application/json', '-d', json.dumps(user_info), - 'http://localhost:8080/apollo/Login?operation=login' + apollo_host + '/Login?operation=login' ] p = _handleExceptionAndCheckCall(array_call) msg = json.loads(p)