arvados-login-sync 2.1.2 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/arvados-login-sync +17 -8
  3. metadata +5 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26bdae065f222a1bf829104d946b977925df1b7ebfa246f6d11e5a362bf45bbf
4
- data.tar.gz: 26bbc165ea34ef4ced71a09425c5db9cefda73d03d5eacfc0c9fe727fb4e9b12
3
+ metadata.gz: 7b64fd1cd8c364cf566914fdc6da7ed744bbb733ab96eaf70e683efe1941a2b3
4
+ data.tar.gz: 492136dd7441fa026b8cc73015de98ec7ddb4f58a971e0fd78824c5b48520825
5
5
  SHA512:
6
- metadata.gz: 614dd9ac71b15ba4f803baad5033d0d0afcaf26ddb05c06e178d5a19d3f9774dde0acea2e971a9dd4342742a716e120236caafa279311103f79f96ecedfbabce
7
- data.tar.gz: 91ba4b18994e78857592d3d44db7224eb68d4aaab3bc5b1d87b7168d4b583c6e8aed304d123b9550d02378378d8f4f252e0fb09425bfc2652a8091c2f8a6db9d
6
+ metadata.gz: a507606b8372c9d73f8030b94aee0976e2a424f38b26a9f38373cce08b6ee754280db659fb9b66c6d27d2a89877d40b10357beb03ca1952a3dd5153432959a7e
7
+ data.tar.gz: 257a5bb6859ed86ba519463dfacefd7303836a8c4a9ef4a25ca50a9f3ff4d3af456dd000e6cd240612aff3c585b9bbfd6692e7673c1a9d091c8dc19714bc6245
@@ -9,6 +9,7 @@ require 'arvados'
9
9
  require 'etc'
10
10
  require 'fileutils'
11
11
  require 'yaml'
12
+ require 'optparse'
12
13
 
13
14
  req_envs = %w(ARVADOS_API_HOST ARVADOS_API_TOKEN ARVADOS_VIRTUAL_MACHINE_UUID)
14
15
  req_envs.each do |k|
@@ -17,16 +18,20 @@ req_envs.each do |k|
17
18
  end
18
19
  end
19
20
 
20
- exclusive_mode = ARGV.index("--exclusive")
21
+ options = {}
22
+ OptionParser.new do |parser|
23
+ parser.on('--exclusive', 'Manage SSH keys file exclusively.')
24
+ parser.on('--rotate-tokens', 'Always create new user tokens. Usually needed with --token-lifetime.')
25
+ parser.on('--skip-missing-users', "Don't try to create any local accounts.")
26
+ parser.on('--token-lifetime SECONDS', 'Create user tokens that expire after SECONDS.', Integer)
27
+ end.parse!(into: options)
28
+
21
29
  exclusive_banner = "#######################################################################################
22
30
  # THIS FILE IS MANAGED BY #{$0} -- CHANGES WILL BE OVERWRITTEN #
23
31
  #######################################################################################\n\n"
24
32
  start_banner = "### BEGIN Arvados-managed keys -- changes between markers will be overwritten\n"
25
33
  end_banner = "### END Arvados-managed keys -- changes between markers will be overwritten\n"
26
34
 
27
- # Don't try to create any local accounts
28
- skip_missing_users = ARGV.index("--skip-missing-users")
29
-
30
35
  keys = ''
31
36
 
32
37
  begin
@@ -64,7 +69,7 @@ begin
64
69
  begin
65
70
  pwnam[l[:username]] = Etc.getpwnam(l[:username])
66
71
  rescue
67
- if skip_missing_users
72
+ if options[:"skip-missing-users"]
68
73
  STDERR.puts "Account #{l[:username]} not found. Skipping"
69
74
  true
70
75
  end
@@ -165,7 +170,7 @@ begin
165
170
  oldkeys = ""
166
171
  end
167
172
 
168
- if exclusive_mode
173
+ if options[:exclusive]
169
174
  newkeys = exclusive_banner + newkeys
170
175
  elsif oldkeys.start_with?(exclusive_banner)
171
176
  newkeys = start_banner + newkeys + end_banner
@@ -192,8 +197,12 @@ begin
192
197
  tokenfile = File.join(configarvados, "settings.conf")
193
198
 
194
199
  begin
195
- if !File.exist?(tokenfile)
196
- user_token = logincluster_arv.api_client_authorization.create(api_client_authorization: {owner_uuid: l[:user_uuid], api_client_id: 0})
200
+ if !File.exist?(tokenfile) || options[:"rotate-tokens"]
201
+ aca_params = {owner_uuid: l[:user_uuid], api_client_id: 0}
202
+ if options[:"token-lifetime"] && options[:"token-lifetime"] > 0
203
+ aca_params.merge!(expires_at: (Time.now + options[:"token-lifetime"]))
204
+ end
205
+ user_token = logincluster_arv.api_client_authorization.create(api_client_authorization: aca_params)
197
206
  f = File.new(tokenfile, 'w')
198
207
  f.write("ARVADOS_API_HOST=#{ENV['ARVADOS_API_HOST']}\n")
199
208
  f.write("ARVADOS_API_TOKEN=v2/#{user_token[:uuid]}/#{user_token[:api_token]}\n")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arvados-login-sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvados Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-22 00:00:00.000000000 Z
11
+ date: 2021-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arvados
@@ -16,20 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.0
20
- - - "~>"
21
- - !ruby/object:Gem::Version
22
- version: 1.3.0
19
+ version: 1.3.3.20190320201707
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 1.3.0
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: 1.3.0
26
+ version: 1.3.3.20190320201707
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: launchy
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +67,7 @@ dependencies:
73
67
  - !ruby/object:Gem::Version
74
68
  version: '0.12'
75
69
  description: Creates and updates local login accounts for Arvados users. Built from
76
- git commit 78096170b070a9eb17b37f913798397744fa1ff5
70
+ git commit 24b0875964b3eff98c12d1c135d8797efcfabfb2
77
71
  email: packaging@arvados.org
78
72
  executables:
79
73
  - arvados-login-sync