[ARVADOS] updated: ee1801fe41f9e3f148a608cdf2d924a71bd171d1
git at public.curoverse.com
git at public.curoverse.com
Tue Aug 25 15:11:54 EDT 2015
Summary of changes:
.../arvados/v1/virtual_machines_controller.rb | 18 +++++++++++-------
.../arvados/v1/virtual_machines_controller_test.rb | 7 +++++++
services/login-sync/bin/arvados-login-sync | 6 +-----
3 files changed, 19 insertions(+), 12 deletions(-)
via ee1801fe41f9e3f148a608cdf2d924a71bd171d1 (commit)
via 638a0c4d0fa6b02f1f04f6f4e0ec496892897ddd (commit)
from b051b44d7f934a22b7cbd8fd76f93017e6229c3c (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 ee1801fe41f9e3f148a608cdf2d924a71bd171d1
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 25 15:10:57 2015 -0400
6781: Clarify "logins" vs. "get_all_logins" APIs by moving common code into render_logins_for.
diff --git a/services/api/app/controllers/arvados/v1/virtual_machines_controller.rb b/services/api/app/controllers/arvados/v1/virtual_machines_controller.rb
index 84251db..e6474aa 100644
--- a/services/api/app/controllers/arvados/v1/virtual_machines_controller.rb
+++ b/services/api/app/controllers/arvados/v1/virtual_machines_controller.rb
@@ -4,18 +4,22 @@ class Arvados::V1::VirtualMachinesController < ApplicationController
before_filter(:admin_required,
:only => [:logins, :get_all_logins])
+ # Get all login permissons (user uuid, login account, SSH key) for a
+ # single VM
def logins
- get_all_logins
+ render_logins_for VirtualMachine.where(uuid: @object.uuid)
end
+ # Get all login permissons for all VMs
def get_all_logins
+ render_logins_for VirtualMachine
+ end
+
+ protected
+
+ def render_logins_for vm_query
@response = []
- @vms = VirtualMachine.eager_load :login_permissions
- if @object
- @vms = @vms.where uuid: @object.uuid
- else
- @vms = @vms.all
- end
+ @vms = vm_query.eager_load :login_permissions
@users = {}
User.eager_load(:authorized_keys).
where('users.uuid in (?)',
diff --git a/services/api/test/functional/arvados/v1/virtual_machines_controller_test.rb b/services/api/test/functional/arvados/v1/virtual_machines_controller_test.rb
index 7c3270c..329bc15 100644
--- a/services/api/test/functional/arvados/v1/virtual_machines_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/virtual_machines_controller_test.rb
@@ -65,4 +65,11 @@ class Arvados::V1::VirtualMachinesControllerTest < ActionController::TestCase
assert_equal u.uuid, json_response['items'][0]['user_uuid']
assert_equal 'bobblogin', json_response['items'][0]['username']
end
+
+ test 'get all logins' do
+ authorize_with :admin
+ get :get_all_logins
+ find_login :admin
+ find_login :active
+ end
end
commit 638a0c4d0fa6b02f1f04f6f4e0ec496892897ddd
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 25 13:51:17 2015 -0400
6781: Do not try /get_all_logins (the new /logins route is now 2 years old).
diff --git a/services/login-sync/bin/arvados-login-sync b/services/login-sync/bin/arvados-login-sync
index 2e407d8..fc11e27 100755
--- a/services/login-sync/bin/arvados-login-sync
+++ b/services/login-sync/bin/arvados-login-sync
@@ -25,11 +25,7 @@ begin
vm_uuid = ENV['ARVADOS_VIRTUAL_MACHINE_UUID']
- begin
- logins = arv.virtual_machine.get_all_logins(limit: 10000, uuid: vm_uuid)[:items]
- rescue
- logins = arv.virtual_machine.logins(:uuid => vm_uuid)[:items]
- end
+ logins = arv.virtual_machine.logins(:uuid => vm_uuid)[:items]
logins = [] if logins.nil?
logins = logins.reject { |l| l[:username].nil? or l[:hostname].nil? or l[:public_key].nil? or l[:virtual_machine_uuid] != vm_uuid }
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list