lmc 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfd78ebb37da9e527f2da6cdf0d7297994c49031cef7af9ce0534f86d2d66b01
4
- data.tar.gz: bada57081f44bbdd303ebf2ebedee80c0e6c21be9e354614ba976ca96d4bc627
3
+ metadata.gz: ea7050b8975d248f8f6c341c900a0987fea13b061ab262d87ab1862aa2a9d169
4
+ data.tar.gz: 00d0fe53b221e06a8f1185c6eca7b48387038d95fb271d466f3b48f5e0761790
5
5
  SHA512:
6
- metadata.gz: 1ada15e1c15fedb1553b6f04334dee02bbcdad709c75b2750487932abd162245ab845b476be3f2d3d71cb43133df1800c2c4fc5b264ee1ba2b9bef339607c083
7
- data.tar.gz: 1d08d68450769836432be5f38e16791de5dbf5bbbbedae30bd8eefd36d3a87aab5982bd0ed64080e30fb30ff673ddc84c8d8e0fec84b714f92276003adef2632
6
+ metadata.gz: 83ef7581a5c3ea7efbfa7245b7238b29a060acca4544c5157074609671dfb4c61e2c1100a1bcf769722a70f870cccb91df56c8ad83baf98db183cb74dd5ee093
7
+ data.tar.gz: f9e91e63ff73a690108bb62cb046d8d342e7017e5edd9e6cdb2715f112b0b8df9a0320ab8ab5cf70cbeb73e5070f1aeda18852d2afad649b6f80b1a771391d2e
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "result": {
3
- "covered_percent": 91.59
3
+ "covered_percent": 91.6
4
4
  }
5
5
  }
data/lib/lmc.rb CHANGED
@@ -5,10 +5,23 @@ require 'restclient'
5
5
 
6
6
  module LMC
7
7
  SERVICELIST = ['cloud-service-auth',
8
+ 'cloud-service-backstage',
9
+ 'cloud-service-config',
8
10
  'cloud-service-devices',
11
+ 'cloud-service-devicetunnel',
12
+ 'cloud-service-dyndns',
13
+ 'cloud-service-fields',
14
+ 'cloud-service-geolocation',
15
+ 'cloud-service-hotspot',
16
+ 'cloud-service-jobs',
9
17
  'cloud-service-monitoring',
10
- 'cloud-service-config',
11
- 'cloud-service-licenses']
18
+ 'cloud-service-messaging',
19
+ 'cloud-service-notification',
20
+ 'cloud-service-licenses',
21
+ 'cloud-service-logging',
22
+ 'cloud-service-preferences',
23
+ 'cloud-service-uf-translator'
24
+ ]
12
25
 
13
26
  def self.useful
14
27
  true
@@ -125,7 +125,7 @@ module LMC
125
125
  def children
126
126
  @cloud.auth_for_accounts([ROOT_ACCOUNT_UUID])
127
127
  # Projects can not have children, return empty map immediately as optimization
128
- if type != "PROJECT"
128
+ if type != 'PROJECT'
129
129
  response = @cloud.get ['cloud-service-auth', 'accounts', id, 'children']
130
130
  response.map { |child| Account.new @cloud, child }
131
131
  else
@@ -7,22 +7,24 @@ require 'restclient'
7
7
  module LMC
8
8
  class Cloud
9
9
  class << self
10
- attr_accessor :cloud_host, :user, :password, :verbose, :debug, :verify_tls, :use_tls
10
+ attr_accessor :cloud_host, :user, :password, :code, :verbose, :debug, :verify_tls, :use_tls
11
11
  Cloud.use_tls = true
12
12
  Cloud.verify_tls = true
13
+ Cloud.code = nil
13
14
  end
14
15
 
15
16
  def self.instance(opts = { authorize: true })
16
- @@inst ||= new(@cloud_host, @user, @password, opts[:authorize])
17
+ @@inst ||= new(@cloud_host, @user, @password, @code, opts[:authorize])
17
18
  end
18
19
 
19
20
  attr_reader :auth_ok, :cloud_host, :user, :password
20
21
 
21
- def initialize(cloud_host, user, pass, auth = true)
22
+ def initialize(cloud_host, user, password, code = nil, auth = true)
22
23
  @auth_ok = false
23
24
  @cloud_host = cloud_host
24
25
  @user = user
25
- @password = pass
26
+ @password = password
27
+ @code = code
26
28
  @verify_tls = Cloud.verify_tls
27
29
  @last_authorized_account_ids = nil
28
30
  @logger ||= ::LMC::Logger.new(STDOUT) if Cloud.debug
@@ -31,7 +33,7 @@ module LMC
31
33
  authorize if auth
32
34
  end
33
35
 
34
- # hide password from dumps
36
+ # hide secret fields from being displayed in dumps
35
37
  def inspect
36
38
  "#<Cloud:#{object_id}, #{build_url}>"
37
39
  end
@@ -153,7 +155,12 @@ module LMC
153
155
  }
154
156
  if account_ids != @last_authorized_account_ids
155
157
  begin
156
- reply = post(['cloud-service-auth', 'auth'], name: @user, password: @password, accountIds: account_ids, termsOfUse: tos)
158
+ reply = post(['cloud-service-auth', 'auth'],
159
+ name: @user,
160
+ password: @password,
161
+ code: @code,
162
+ accountIds: account_ids,
163
+ termsOfUse: tos)
157
164
  @last_authorized_account_ids = account_ids
158
165
  @auth_token = reply
159
166
  @auth_ok = true
@@ -162,6 +169,7 @@ module LMC
162
169
  if response['code'] == 100
163
170
  raise LMC::OutdatedTermsOfUseException.new(response)
164
171
  end
172
+ raise e
165
173
  end
166
174
  end
167
175
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LMC
4
- VERSION = '0.12.1'
4
+ VERSION = '0.13.0'
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lmc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - erpel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-04 00:00:00.000000000 Z
11
+ date: 2021-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '2.0'
153
- description:
153
+ description:
154
154
  email:
155
155
  - philipp@copythat.de
156
156
  executables: []
@@ -201,11 +201,11 @@ files:
201
201
  - lib/lmc/version.rb
202
202
  - lmc.gemspec
203
203
  - misc/debug_log_experiment.rb
204
- homepage:
204
+ homepage:
205
205
  licenses:
206
206
  - BSD-3-Clause
207
207
  metadata: {}
208
- post_install_message:
208
+ post_install_message:
209
209
  rdoc_options: []
210
210
  require_paths:
211
211
  - lib
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubygems_version: 3.1.2
224
- signing_key:
224
+ signing_key:
225
225
  specification_version: 4
226
226
  summary: Library for interacting with LMC cloud instances
227
227
  test_files: []