arvados-login-sync 2.1.3 → 2.1.4

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: 4fe54752e66d13daa0a6bae94d7932f54913a9fe7d9d787f940fc46da9ccc879
4
- data.tar.gz: d55e23135dfe1858e7bed47f7fd4c5b68206e3ac814c06bc032acdb59d749b34
3
+ metadata.gz: 1649de19adca3150f2b8a12cebb2526e091e6a7bcee92950c5f928def0f7251e
4
+ data.tar.gz: eae88fada46a855bb0e97106416bbe404f2cc45ac3a0e52e726fabb1559a2949
5
5
  SHA512:
6
- metadata.gz: cbb967d7f11a2088294a0b645a935da43aecc43e293d267b7083108d81f597bc8eeec5a3158780b60198d4e562ff1d247e11ddb43777af8afc2abc8902abff7e
7
- data.tar.gz: 61e0a6bf9520596cf74ac5f41ab4c6da622330a735a54f5e6711c04ae115734f660c93a2bcf6f769b77cdd18620373035bbaf60fc99403d32561d17f9d98212d
6
+ metadata.gz: 88ee48dee0be319e3048e33eb7da27d52f4d05105a2318ca732eb0e9bb9831139063caeedcdb45f2fcbb8f3de373e335de041aadf63d44f06ddcfbd917c72112
7
+ data.tar.gz: 66104002ae2b2fff08c9563f117c3bcec6c2c606544887ada281661f7bbc69e47d7c448d64bc0ba7cb77a082a0f87cb9b86427e72b9ffda9e9fa92c7b83c6535
@@ -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.3
4
+ version: 2.1.4
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