foreman_maintain 1.0.6 → 1.0.7

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: 41c40d80a596e78552a9e066e6d769db4fe57cd9e7c7368a7d64cf21f68edefa
4
- data.tar.gz: 4908652d3cc57dde9b08081b0d5fa20fac5cc9f8ab41f19778243a29b0963002
3
+ metadata.gz: 1db04c176ed0a5d5293dd9980db6c05e7f2c29c43f7da63d622e917c692d49ce
4
+ data.tar.gz: 2d41a5d195c217f7c7764b2543ed43ec3bacfac1339aad2162431052286775ca
5
5
  SHA512:
6
- metadata.gz: aa7003129978adaa2e1798c3fa191a5be628403b1d86df618bd92110829de5b8f0cd81a2f6c97b1df2befeeda693ba950acdf985c843482d2d027d333e771957
7
- data.tar.gz: 1c16a69c401058063919df5c8b8a595a4b04d17c5662f93e12b9999bfa5e566f6276b1b4a1998ffb5a3d3f964af76a8275eae68554826a22b4aef8f3ca7b81fb
6
+ metadata.gz: d321a63d2e313db2694dbd70c138c498c829843b5ac891d33e91969a682494f94971b1411dbe81228f1e049bfb35b3a3ba2dc9c59d08629aa4297baff20210ad
7
+ data.tar.gz: a53ce7c727dbbf92d7257e7024587ba33a1e7db9b27c17fccf5e3ecc9ede63173bdcbcef2cd7f51173a3d88df661b6dd2e0f68fab05ea0983b8f657e9f02beae
@@ -13,15 +13,22 @@ module ForemanMaintain::Scenarios
13
13
  end
14
14
 
15
15
  def target_version
16
- @target_version ||= context.get(:target_version)
16
+ current_full_version = feature(:instance).downstream.current_version
17
+ @target_version ||= current_full_version.bump
17
18
  end
18
19
 
19
20
  def current_version
20
21
  feature(:instance).downstream.current_minor_version
21
22
  end
22
23
 
24
+ def maintenance_repo_label
25
+ @maintenance_repo_label ||= context.get(:maintenance_repo_label)
26
+ end
27
+
23
28
  def maintenance_repo_id(version)
24
- if (repo = ENV['maintenance_repo'])
29
+ if maintenance_repo_label
30
+ return maintenance_repo_label
31
+ elsif (repo = ENV['MAINTENANCE_REPO_LABEL'])
25
32
  return repo unless repo.empty?
26
33
  end
27
34
 
@@ -64,7 +71,9 @@ module ForemanMaintain::Scenarios
64
71
  end
65
72
 
66
73
  def use_rhsm?
67
- if (repo = ENV['maintenance_repo'])
74
+ return false if maintenance_repo_label
75
+
76
+ if (repo = ENV['MAINTENANCE_REPO_LABEL'])
68
77
  return false unless repo.empty?
69
78
  end
70
79
 
@@ -1,38 +1,23 @@
1
1
  module ForemanMaintain
2
2
  module Cli
3
3
  class SelfUpgradeCommand < Base
4
- option ['--target-version'], 'TARGET_VERSION',\
5
- 'Major version of the Satellite or Capsule'\
6
- ', e.g 6.11', :required => true
4
+ option ['--maintenance-repo-label'], 'REPOSITORY_LABEL',\
5
+ 'Repository label from which packages should be updated.'\
6
+ 'This can be used when standard CDN repositories are unavailable.'
7
7
  def execute
8
- allow_major_version_upgrade_only
9
8
  run_scenario(upgrade_scenario, upgrade_rescue_scenario)
10
9
  end
11
10
 
12
11
  def upgrade_scenario
13
- Scenarios::SelfUpgrade.new(target_version: target_version)
12
+ Scenarios::SelfUpgrade.new(
13
+ maintenance_repo_label: maintenance_repo_label
14
+ )
14
15
  end
15
16
 
16
17
  def upgrade_rescue_scenario
17
- Scenarios::SelfUpgradeRescue.new(target_version: target_version)
18
- end
19
-
20
- def current_downstream_version
21
- ForemanMaintain.detector.feature(:instance).downstream.current_version
22
- end
23
-
24
- def allow_major_version_upgrade_only
25
- begin
26
- next_version = Gem::Version.new(target_version)
27
- rescue ArgumentError => err
28
- raise Error::UsageError, "Invalid version! #{err}"
29
- end
30
- if current_downstream_version >= next_version
31
- message = "The target-version #{target_version} should be "\
32
- "greater than existing version #{current_downstream_version},"\
33
- "\nand self-upgrade should be used for major version upgrades only!"
34
- raise Error::UsageError, message
35
- end
18
+ Scenarios::SelfUpgradeRescue.new(
19
+ maintenance_repo_label: maintenance_repo_label
20
+ )
36
21
  end
37
22
  end
38
23
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.0.6'.freeze
2
+ VERSION = '1.0.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_maintain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-30 00:00:00.000000000 Z
11
+ date: 2022-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp