[ARVADOS] updated: 5a9684ac02fb535d1ad5cc80a6390d758415d0d5

git at public.curoverse.com git at public.curoverse.com
Wed Jul 8 11:32:47 EDT 2015


Summary of changes:
 sdk/pam/arvados_pam.py     | 17 +++++++++++------
 sdk/pam/debian/arvados_pam | 10 ++++++++++
 2 files changed, 21 insertions(+), 6 deletions(-)
 create mode 100644 sdk/pam/debian/arvados_pam

       via  5a9684ac02fb535d1ad5cc80a6390d758415d0d5 (commit)
      from  3eedcb355e3dfdc4b8006083cfbcf2610b9d895d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 5a9684ac02fb535d1ad5cc80a6390d758415d0d5
Author: Nico Cesar <nico at curoverse.com>
Date:   Wed Jul 8 11:30:49 2015 -0400

    added /etc/default/arvados_pam as a parameter
    
    refs #6512

diff --git a/sdk/pam/arvados_pam.py b/sdk/pam/arvados_pam.py
index 84eef24..bc65b06 100644
--- a/sdk/pam/arvados_pam.py
+++ b/sdk/pam/arvados_pam.py
@@ -14,25 +14,30 @@ def auth_log(msg):
 
 def check_arvados_token(requested_username, token):
     auth_log("%s %s" % (requested_username, token))
-    ARVADOS_API_HOST='4xphq.arvadosapi.com' ## FIXME replace with puppet
-    # BUG: hostname stored on the API is just "foo.shell", not "foo.shell.zzzzz.arvadosapi.com"!
-    my_hostname='shell' ## FIXME replace with puppet
 
     try:
-	arv = arvados.api('v1',host=ARVADOS_API_HOST, token=token, cache=None)
+ 	f=file('/etc/default/arvados_pam')
+	config=dict([l for l in f.readlines() if not l.startswith('#') or l.strip()==""])
+	arvados_api_host=config['ARVADOS_API_HOST'].strip()
+	hostname=config['HOSTNAME'].strip()
+    except Exception as e:
+	auth_log("problem getting default values" % (str(e)))
+
+    try:
+	arv = arvados.api('v1',host=arvados_api_host, token=token, cache=None)
     except Exception as e:
 	auth_log(str(e))
 	return False
 
     try:
-	matches = arv.virtual_machines().list(filters=[['hostname','=',my_hostname]]).execute()['items']
+	matches = arv.virtual_machines().list(filters=[['hostname','=',hostname]]).execute()['items']
     except Exception as e:
 	auth_log(str(e))
 	return False
 
 
     if len(matches) != 1:
-        auth_log("libpam_arvados could not dertermine vm uuid for '%s'" % my_hostname)
+        auth_log("libpam_arvados could not dertermine vm uuid for '%s'" % hostname)
         return False
 
     this_vm_uuid = matches[0]['uuid']
diff --git a/sdk/pam/debian/arvados_pam b/sdk/pam/debian/arvados_pam
new file mode 100644
index 0000000..eae61d9
--- /dev/null
+++ b/sdk/pam/debian/arvados_pam
@@ -0,0 +1,10 @@
+# Default values for libpam arvados module
+#
+# ARVADOS_API_HOST should be te api hosts.
+# should be reachable, and will be called
+# from arvados_pam.py using Arvados Python SDK
+ARVADOS_API_HOST=zzzzz.arvadosapi.com
+
+# HOSTNAME is the hostname as is stored in the API object
+# something like "foo.shell" or "shell", but not"foo.shell.zzzzz.arvadosapi.com"!
+HOSTNAME=shell

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list