foreman_maintain 0.7.13 → 0.7.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4553337c4db35ead0b3f07871424c164b2df46bd1c8fc14937dc49768c428c29
4
- data.tar.gz: 43aa2647efacc81fdb48b6c7aec36c791208c77cf637b1e187d8fda89b5c5053
3
+ metadata.gz: f85f48176164ae330cdc34b3358f7a28e9db102b0a4a1a3f56096545914a80d7
4
+ data.tar.gz: 218abc9daddc63f1ea18f4a652fe7c0ab29471d1ba57025b6fe4bfec1ef517ee
5
5
  SHA512:
6
- metadata.gz: 31c1e4710e552ce9fc04b66c497c86a3b1bc7cd27cf0feb025000026a5d5d148babe963f8c3090a2243c0f1f983b3bbbcd2113e3b391e84e3eb191eff5b75af2
7
- data.tar.gz: 89158ea71347163b42ad198e978bec7990a581667049c5914c3c563216f233ae21a01d95dc52885699ed0777e449533a0657d45b045370abf5ddb07dae60bf52
6
+ metadata.gz: 6298d9c15def6a3e6f3fca79c1a917c583f4af0bc0281559abdc96e82f15820975ad109d9443bbb412da8396a5df7b3b94a6a7a00cd28fce2b3af6cb5d97eaa0
7
+ data.tar.gz: e572a81b1e74edc22985ef67e8e9d9e84af85161bb78105d32617962a90ddf016447e77a17cd7299254819e9987304709f991a65a2c4b4b59a95081c5c7c2490
@@ -3,11 +3,13 @@ module Procedures::Content
3
3
  metadata do
4
4
  description 'Prepare content for Pulp 3'
5
5
  for_feature :pulpcore
6
+ param :quiet, 'Keep the output on a single line', :flag => true, :default => false
6
7
  end
7
8
 
8
9
  def run
9
10
  # use interactive to get realtime output
10
- puts execute!('foreman-rake katello:pulp3_migration', :interactive => true)
11
+ env_vars = @quiet ? '' : 'preserve_output=true '
12
+ puts execute!("#{env_vars}foreman-rake katello:pulp3_migration", :interactive => true)
11
13
  end
12
14
  end
13
15
  end
@@ -2,11 +2,10 @@ module ForemanMaintain::Scenarios
2
2
  module Content
3
3
  class ContentBase < ForemanMaintain::Scenario
4
4
  def enable_and_start_services
5
- add_step(Procedures::Service::Start)
6
5
  add_step(Procedures::Service::Enable.
7
6
  new(:only => Features::Pulpcore.pulpcore_migration_services))
8
7
  add_step(Procedures::Service::Start.
9
- new(:only => Features::Pulpcore.pulpcore_migration_services))
8
+ new(:include => Features::Pulpcore.pulpcore_migration_services))
10
9
  end
11
10
 
12
11
  def disable_and_stop_services
@@ -27,12 +26,18 @@ module ForemanMaintain::Scenarios
27
26
  def compose
28
27
  if feature(:satellite) && feature(:satellite).at_least_version?('6.9')
29
28
  enable_and_start_services
30
- add_step(Procedures::Content::Prepare)
29
+ add_step(Procedures::Content::Prepare.new(quiet: quiet?))
31
30
  disable_and_stop_services
32
31
  elsif !feature(:satellite)
33
- add_step(Procedures::Content::Prepare)
32
+ add_step(Procedures::Content::Prepare.new(quiet: quiet?))
34
33
  end
35
34
  end
35
+
36
+ private
37
+
38
+ def quiet?
39
+ !!context.get(:quiet)
40
+ end
36
41
  end
37
42
 
38
43
  class Switchover < ContentBase
@@ -60,6 +65,7 @@ module ForemanMaintain::Scenarios
60
65
 
61
66
  def compose
62
67
  if !feature(:satellite) || feature(:satellite).at_least_version?('6.9')
68
+ enable_and_start_services if feature(:satellite)
63
69
  add_step(Procedures::Content::PrepareAbort)
64
70
  end
65
71
  end
@@ -2,8 +2,9 @@ module ForemanMaintain
2
2
  module Cli
3
3
  class ContentCommand < Base
4
4
  subcommand 'prepare', 'Prepare content for Pulp 3' do
5
+ option ['-q', '--quiet'], :flag, 'Keep the output on a single line'
5
6
  def execute
6
- run_scenarios_and_exit(Scenarios::Content::Prepare.new)
7
+ run_scenarios_and_exit(Scenarios::Content::Prepare.new(:quiet => quiet?))
7
8
  end
8
9
  end
9
10
 
@@ -59,12 +59,15 @@ module ForemanMaintain
59
59
 
60
60
  private
61
61
 
62
+ # rubocop:disable Metrics/MethodLength
62
63
  def run_interactively
63
64
  # use tmp files to capture output and exit status of the command when
64
65
  # running interactively
65
66
  log_file = Tempfile.open('captured-output')
66
67
  exit_file = Tempfile.open('captured-exit-code')
67
- Kernel.system("script -qc '#{full_command}; echo $? > #{exit_file.path}' #{log_file.path}")
68
+ Kernel.system(
69
+ "bash -c '#{full_command}; echo $? > #{exit_file.path}' | tee -i #{log_file.path}"
70
+ )
68
71
  File.open(log_file.path) { |f| @output = f.read }
69
72
  File.open(exit_file.path) do |f|
70
73
  exit_status = f.read.strip
@@ -78,6 +81,7 @@ module ForemanMaintain
78
81
  log_file.close
79
82
  exit_file.close
80
83
  end
84
+ # rubocop:enable Metrics/MethodLength
81
85
 
82
86
  def run_non_interactively
83
87
  IO.popen(full_command, 'r+') do |f|
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '0.7.13'.freeze
2
+ VERSION = '0.7.14'.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: 0.7.13
4
+ version: 0.7.14
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: 2021-08-30 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp