mux_tf 0.14.1 → 0.15.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: 5875848c6220b58d151de49758928a516c3d95dad15ad105079c94440258654b
4
- data.tar.gz: 4ad787f7871c34fcbaf1a4d9c6bea8a73788d4ec54179c32a5916d79e4d80af5
3
+ metadata.gz: 5eb20c09b5f5f2fcccfc4ed93018fe52ec1aaf75f5e60981fd0eff0bba895466
4
+ data.tar.gz: 8122a0889cf0da6fa0e237ab94ecac94920daf4f863a218dba8df9bf0cfcc5a1
5
5
  SHA512:
6
- metadata.gz: f57c23d5a25413d610891025de1c0c3453b29170a93e0c0a11437b673fd9f06e0af6378dcac2f21b2b4e12f54b894a534ad71b3b0dbb6c45fe36ea83ba1b9794
7
- data.tar.gz: 477bcebacc8607aff82536795301e59c6c1304b4b54bbe81f5482c0f81ec968f7e6c2acfc768aa6cf793a8572dfee23b4640093e5d33db6fdc4dee724fba2864
6
+ metadata.gz: 020b9f50b507c0f91b6b64bcfbf027010d3a39de8e47829e5fb9dc0407af2e0c850c7fc1942b23e64febf603e028c608d2f0ce86324a7bac410c4c05cfddeea6
7
+ data.tar.gz: aacb58be2f7c86984354d1aad771b898eb7f6979a25df2465448233730ad7db5178914e5b76add063de42536b2358e4c2ef8c4b763819158f079a41d349f2671
@@ -87,7 +87,7 @@ module MuxTf
87
87
  return results if remedies.empty?
88
88
 
89
89
  remedy_status, _remedy_results = process_remedies(remedies, from: from, level: level)
90
- return unless remedy_status
90
+ return remedy_status if remedy_status
91
91
  end
92
92
  log "!! giving up because attempt: #{attempt}"
93
93
  end
@@ -162,6 +162,18 @@ module MuxTf
162
162
  log wrap_log["-" * 40, color: :red]
163
163
  return [false, results]
164
164
  end
165
+ if remedies.delete? :auth
166
+ remedy = :auth
167
+ log wrap_log["auth error encountered!", color: :red]
168
+ log wrap_log["-" * 40, color: :red]
169
+ log wrap_log["!! Auth Error, Please fix the issue and try again", color: :red]
170
+ log wrap_log["-" * 40, color: :red]
171
+ return [false, results]
172
+ end
173
+
174
+ # if there is warnings, but no other remedies .. then we assume all is ok
175
+ return [true, results] if remedies.delete?(:user_warning) && remedies.empty?
176
+
165
177
  unless remedies.empty?
166
178
  remedy = nil
167
179
  log wrap_log["Unprocessed remedies: #{remedies.to_a}", color: :red], depth: 1 if level == 1
@@ -408,6 +420,7 @@ module MuxTf
408
420
  remedies << :plan if error[:message].include?("timeout while waiting for plugin to start")
409
421
  end
410
422
  remedies << :unlock if lock_error?(meta)
423
+ remedies << :auth if meta[:need_auth]
411
424
  remedies
412
425
  end
413
426
 
@@ -439,6 +452,8 @@ module MuxTf
439
452
  throw :abort, [plan_status, meta]
440
453
  end
441
454
 
455
+ throw :abort, [plan_status, meta] if remedies.include?(:auth)
456
+
442
457
  [remedies, plan_status, meta]
443
458
  }
444
459
 
@@ -396,6 +396,9 @@ module MuxTf
396
396
  when :none
397
397
  if line.blank?
398
398
  # nothing
399
+ elsif raw_line.match(/Error when retrieving token from sso/) || raw_line.match(/Error loading SSO Token/)
400
+ meta[:need_auth] = true
401
+ log pastel.red("authentication problem"), depth: 2
399
402
  else
400
403
  log_unhandled_line(state, line, reason: "unexpected non blank line in :none state")
401
404
  end
@@ -470,8 +473,12 @@ module MuxTf
470
473
  remedies = Set.new
471
474
  if status != 0
472
475
  remedies << :reconfigure if meta[:need_reconfigure]
473
- meta[:errors].each do |error|
474
- remedies << :add_provider_constraint if error[:body].grep(/Could not retrieve the list of available versions for provider/)
476
+ remedies << :auth if meta[:need_auth]
477
+ log "!! expected meta[:errors] to be set, how did we get here?" unless meta[:errors]
478
+ if meta[:errors]
479
+ meta[:errors].each do |error|
480
+ remedies << :add_provider_constraint if error[:body].grep(/Could not retrieve the list of available versions for provider/)
481
+ end
475
482
  end
476
483
  if remedies.empty?
477
484
  log "!! don't know how to generate init remedies for this"
@@ -541,10 +548,12 @@ module MuxTf
541
548
  parser.state(:backend, /^Initializing the backend\.\.\./, [:none, :modules_init, :modules_upgrade])
542
549
  parser.state(:plugins, /^Initializing provider plugins\.\.\./, [:backend, :modules_init])
543
550
 
551
+ parser.state(:backend_error, /Error when retrieving token from sso/, [:backend])
552
+
544
553
  parser.state(:plugin_warnings, /^$/, [:plugins])
545
554
  parser.state(:backend_error, /Error:/, [:backend])
546
555
 
547
- setup_error_handling(parser, from_states: [:plugins])
556
+ setup_error_handling(parser, from_states: [:plugins, :modules_init])
548
557
 
549
558
  status = tf_init(upgrade: upgrade, reconfigure: reconfigure) { |raw_line|
550
559
  stripped_line = pastel.strip(raw_line.rstrip)
@@ -610,6 +619,10 @@ module MuxTf
610
619
  meta[:need_reconfigure] = true
611
620
  log pastel.red("module needs to be reconfigured"), depth: 2
612
621
  end
622
+ if raw_line.match "Error when retrieving token from sso"
623
+ meta[:need_auth] = true
624
+ log pastel.red("authentication problem"), depth: 2
625
+ end
613
626
  when :plugins
614
627
  if phase != state
615
628
  # first line
@@ -721,6 +734,11 @@ module MuxTf
721
734
  item_handled = true
722
735
  end
723
736
 
737
+ if dinfo["severity"] == "warning"
738
+ remedies << :user_warning
739
+ item_handled = true
740
+ end
741
+
724
742
  next if item_handled
725
743
 
726
744
  puts "!! don't know how to handle this validation error"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuxTf
4
- VERSION = "0.14.1"
4
+ VERSION = "0.15.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mux_tf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Banasik
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-01 00:00:00.000000000 Z
11
+ date: 2024-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport