[ARVADOS] updated: 9b10524c349d0c28a6dcf33ad0a473c3eb2d2b2f

git at public.curoverse.com git at public.curoverse.com
Mon Mar 17 14:16:10 EDT 2014


Summary of changes:
 services/api/script/setup-new-user.rb |   50 +++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)
 create mode 100755 services/api/script/setup-new-user.rb

       via  9b10524c349d0c28a6dcf33ad0a473c3eb2d2b2f (commit)
      from  dc01c0405fbc4c17e3fc947dd154e1adb915a790 (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 9b10524c349d0c28a6dcf33ad0a473c3eb2d2b2f
Author: radhika chippada <radhika at radhika.curoverse>
Date:   Mon Mar 17 14:14:10 2014 -0400

    A simplified version of setup_new_user.rb script, where all the create user and links logic is moved into users controller.

diff --git a/services/api/script/setup-new-user.rb b/services/api/script/setup-new-user.rb
new file mode 100755
index 0000000..c8bc098
--- /dev/null
+++ b/services/api/script/setup-new-user.rb
@@ -0,0 +1,50 @@
+#!/usr/bin/env ruby
+
+abort 'Error: Ruby >= 1.9.3 required.' if RUBY_VERSION < '1.9.3'
+
+require 'logger'
+require 'trollop'
+log = Logger.new STDERR
+log.progname = $0.split('/').last
+
+opts = Trollop::options do
+  banner ''
+  banner "Usage: #{log.progname} " +
+    "{user_uuid_or_email} {user_and_repo_name} {vm_uuid}"
+  banner ''
+  opt :debug, <<-eos
+Show debug messages.
+  eos
+  opt :create, <<-eos
+Create a new user with the given email address if an existing user \
+is not found.
+  eos
+  opt :openid_prefix, <<-eos, default: 'https://www.google.com/accounts/o8/id'
+If creating a new user record, require authentication from an OpenID \
+with this OpenID prefix *and* a matching email address in order to \
+claim the account.
+  eos
+  opt :force, <<-eos
+Continue even if sanity checks raise flags: the given user is already \
+active, the given repository already exists, etc.
+  eos
+  opt :n, 'Do not change anything, just probe'
+end
+
+log.level = (ENV['DEBUG'] || opts.debug) ? Logger::DEBUG : Logger::WARN
+    
+if ARGV.count != 3
+  Trollop::die "required arguments are missing"
+end
+user_arg, user_repo_name, vm_uuid = ARGV
+
+require 'arvados'
+arv = Arvados.new(api_version: 'v1')
+
+begin
+	new_user = arv.user.create(user_param: user_arg, repo_name: user_repo_name, vm_uuid: vm_uuid, openid_prefix: opts.openid_prefix, just_probe: opts.n, user: {})
+	log.warn new_user
+rescue Exception => e #Arvados::TransactionFailedError
+	log.warn e.message
+end
+

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list