arvados 0.1.20140429135621 → 0.1.20140429160120

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/lib/arvados.rb +27 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60bb7aa549830bdafdb23907483883a7d88fc97e
4
- data.tar.gz: 0f592b2645573f5db75de49968f8a3c4e90f0793
3
+ metadata.gz: 30e53a35bdb039f15e734d12fdd309394ef51232
4
+ data.tar.gz: 3d0059f45359f85615719fe43efb79573b4f823a
5
5
  SHA512:
6
- metadata.gz: 011381380fd2528bb82af23290d383ed9305cf2a1853ac6d0e5fea76558774381db8d7a55e0ddb19be20ba23f970174787d4ada2e6e213e86c0bcaefe590a38c
7
- data.tar.gz: 836f44135fd7f5183b473ff98f70d4ca6ef16220effa04e06f325b94958b1968c8df4cb52a42e3e1a361329a2b0dd8020428a2fe364845f35bc7b3e08bb521d7
6
+ metadata.gz: 8dbddab8972cba6ddfe70d09fd0c4f680c846069368fe497334fff219669c193cd4971aba0ee31f9dd2b81d9f445deea0ebbb0b46285a33386d38758d71164df
7
+ data.tar.gz: a6da92a5680504063fe0de1b83a13135376b45f929cfbcc22e8349b6ef0c72cb26e59bdc8642dbf5ac9bb7bf5ba8d4186917238221655b001c89c5f8ec4ab809
@@ -35,9 +35,8 @@ class Arvados
35
35
  @application_version ||= 0.0
36
36
  @application_name ||= File.split($0).last
37
37
 
38
- @arvados_api_version = opts[:api_version] ||
39
- config['ARVADOS_API_VERSION'] ||
40
- 'v1'
38
+ @arvados_api_version = opts[:api_version] || 'v1'
39
+
41
40
  @arvados_api_host = opts[:api_host] ||
42
41
  config['ARVADOS_API_HOST'] or
43
42
  raise "#{$0}: no :api_host or ENV[ARVADOS_API_HOST] provided."
@@ -46,7 +45,8 @@ class Arvados
46
45
  raise "#{$0}: no :api_token or ENV[ARVADOS_API_TOKEN] provided."
47
46
 
48
47
  if (opts[:suppress_ssl_warnings] or
49
- config['ARVADOS_API_HOST_INSECURE'])
48
+ %w(1 true yes).index(config['ARVADOS_API_HOST_INSECURE'].
49
+ andand.downcase))
50
50
  suppress_warnings do
51
51
  OpenSSL::SSL.const_set 'VERIFY_PEER', OpenSSL::SSL::VERIFY_NONE
52
52
  end
@@ -142,6 +142,10 @@ class Arvados
142
142
  $stderr.puts "#{File.split($0).last} #{$$}: #{message}" if @@debuglevel >= verbosity
143
143
  end
144
144
 
145
+ def debuglog *args
146
+ self.class.debuglog *args
147
+ end
148
+
145
149
  def config(config_file_path="~/.config/arvados/settings.conf")
146
150
  return @@config if @@config
147
151
 
@@ -150,7 +154,19 @@ class Arvados
150
154
  config['ARVADOS_API_HOST'] = ENV['ARVADOS_API_HOST']
151
155
  config['ARVADOS_API_TOKEN'] = ENV['ARVADOS_API_TOKEN']
152
156
  config['ARVADOS_API_HOST_INSECURE'] = ENV['ARVADOS_API_HOST_INSECURE']
153
- config['ARVADOS_API_VERSION'] = ENV['ARVADOS_API_VERSION']
157
+
158
+ if config['ARVADOS_API_HOST'] and config['ARVADOS_API_TOKEN']
159
+ # Environment variables take precedence over the config file, so
160
+ # there is no point reading the config file. If the environment
161
+ # specifies a _HOST without asking for _INSECURE, we certainly
162
+ # shouldn't give the config file a chance to create a
163
+ # system-wide _INSECURE state for this user.
164
+ #
165
+ # Note: If we start using additional configuration settings from
166
+ # this file in the future, we might have to read the file anyway
167
+ # instead of returning here.
168
+ return (@@config = config)
169
+ end
154
170
 
155
171
  begin
156
172
  expanded_path = File.expand_path config_file_path
@@ -162,16 +178,18 @@ class Arvados
162
178
  # skip comments and blank lines
163
179
  next if line.match('^\s*#') or not line.match('\S')
164
180
  var, val = line.chomp.split('=', 2)
181
+ var.strip!
182
+ val.strip!
165
183
  # allow environment settings to override config files.
166
- if var and val
184
+ if !var.empty? and val
167
185
  config[var] ||= val
168
186
  else
169
- warn "#{expanded_path}: #{lineno}: could not parse `#{line}'"
187
+ debuglog "#{expanded_path}: #{lineno}: could not parse `#{line}'", 0
170
188
  end
171
189
  end
172
190
  end
173
- rescue
174
- debuglog "HOME environment variable (#{ENV['HOME']}) not set, not using #{config_file_path}", 0
191
+ rescue StandardError => e
192
+ debuglog "Ignoring error reading #{config_file_path}: #{e}", 0
175
193
  end
176
194
 
177
195
  @@config = config
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arvados
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20140429135621
4
+ version: 0.1.20140429160120
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvados Authors
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: This is the Arvados SDK gem, git revision c18bde8300e115b215e58d6930d0495b2c33b49f
69
+ description: This is the Arvados SDK gem, git revision 8eaad00b025167a7505ba11ad6a05b52a43c2399
70
70
  email: gem-dev@curoverse.com
71
71
  executables: []
72
72
  extensions: []