foreman_maintain 1.10.0 → 1.10.1

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: f0e6da9a83b7060020dd78da8a1fd8887e4b76708471b3ee80802335e5252224
4
- data.tar.gz: 4fdb27b3583aa2665bd76e725d748408c19e956c9959ed2513d17eb234ae4e7b
3
+ metadata.gz: 4bb62d8f6b441155dfbdbc8bad79f1ec79b620dcee19e5cb37229d77634552a2
4
+ data.tar.gz: d87d6b6149373f2e0be0cacfeaff2c83b675c9b92c9d5efad94cc8ccf6bba15d
5
5
  SHA512:
6
- metadata.gz: 8cd917d7a19d07c9674b8c7a31ffd45378d936b27fa8442ad18ebf004d1b9084fba86b9e67747c66f4dc91a23b0426c7e1fb9442f501678ece2b950eb45efe7d
7
- data.tar.gz: 965c7051bc9623d274d7c38b0a13fb4919f9e84d5651e22cb8b7faf827e9fc0b1f883c9154fae72f56b33c0fa5fe4cae6fd5b4432ebc44d0cc943c8b44982926
6
+ metadata.gz: 1a5897ac90ff9a5a9801bd456b7fc6cb4f186c6e582ca92895c449a06bd9d99480aed848a58ab2281dd65a3ea1e6a9b5fbcb4e85c7f4cea5180826bccb383e4b
7
+ data.tar.gz: d34018e15a798fb66efde83a56fd5a979d153a658ffa085f456ad6ea53b46544a0bd3d41b4a3e966f8fbae09e81bcfd049c5ac864ab803d1b03db3eae2acd89b
@@ -21,7 +21,7 @@ class Features::Pulpcore < ForemanMaintain::Feature
21
21
  end
22
22
 
23
23
  def cli(args)
24
- parse_json(execute!("pulp --format json #{args}"))
24
+ parse_json(execute!("pulp --format json #{args}", merge_stderr: false))
25
25
  end
26
26
 
27
27
  def running_tasks
@@ -31,7 +31,7 @@ class Features::PulpcoreDatabase < ForemanMaintain::Feature
31
31
  from django.conf import settings; import json; print(json.dumps(settings.DATABASES["default"]))
32
32
  PYTHON
33
33
  manager_command = pulpcore_manager("shell --command '#{python_command}'")
34
- manager_result = execute!(manager_command)
34
+ manager_result = execute!(manager_command, merge_stderr: false)
35
35
  db_config = JSON.parse(manager_result)
36
36
 
37
37
  @configuration = {}
@@ -94,6 +94,8 @@ module ForemanMaintain::Scenarios
94
94
  :online_backup => true)
95
95
  add_step_with_context(Procedures::Backup::Pulp, :ensure_unchanged => true)
96
96
  add_database_backup_steps
97
+
98
+ add_step(Procedures::Service::Start.new(:only => online_workers)) unless online_workers.empty?
97
99
  end
98
100
 
99
101
  def add_database_backup_steps
@@ -102,8 +104,6 @@ module ForemanMaintain::Scenarios
102
104
  Procedures::Backup::Online::ForemanDB,
103
105
  Procedures::Backup::Online::PulpcoreDB
104
106
  )
105
-
106
- add_step(Procedures::Service::Start.new(:only => online_workers)) unless online_workers.empty?
107
107
  end
108
108
 
109
109
  def strategy
@@ -1,4 +1,4 @@
1
- require 'English'
1
+ require 'open3'
2
2
  require 'tempfile'
3
3
 
4
4
  module ForemanMaintain
@@ -8,7 +8,7 @@ module ForemanMaintain
8
8
  attr_reader :logger, :command
9
9
 
10
10
  def initialize(logger, command, options)
11
- options.validate_options!(:stdin, :interactive, :valid_exit_statuses, :env)
11
+ options.validate_options!(:stdin, :interactive, :valid_exit_statuses, :env, :merge_stderr)
12
12
  options[:valid_exit_statuses] ||= [0]
13
13
  options[:env] ||= {}
14
14
  @logger = logger
@@ -18,6 +18,7 @@ module ForemanMaintain
18
18
  @options = options
19
19
  @valid_exit_statuses = options[:valid_exit_statuses]
20
20
  @env = options[:env]
21
+ @merge_stderr = options.fetch(:merge_stderr, true)
21
22
  raise ArgumentError, 'Can not pass stdin for interactive command' if @interactive && @stdin
22
23
  end
23
24
 
@@ -45,6 +46,11 @@ module ForemanMaintain
45
46
  @exit_status
46
47
  end
47
48
 
49
+ def stderr
50
+ raise 'Command not yet executed' unless defined? @stderr
51
+ @stderr
52
+ end
53
+
48
54
  def success?
49
55
  @valid_exit_statuses.include? exit_status
50
56
  end
@@ -82,18 +88,16 @@ module ForemanMaintain
82
88
  end
83
89
 
84
90
  def run_non_interactively
85
- IO.popen(@env, full_command, 'r+') do |f|
86
- if @stdin
87
- f.puts(@stdin)
88
- f.close_write
89
- end
90
- @output = f.read.strip
91
- end
92
- @exit_status = $CHILD_STATUS.exitstatus
91
+ @output, @stderr, status = Open3.capture3(@env, full_command, :stdin_data => @stdin)
92
+ @exit_status = status.exitstatus
93
93
  end
94
94
 
95
95
  def full_command
96
- "#{@command} 2>&1"
96
+ if @merge_stderr
97
+ "#{@command} 2>&1"
98
+ else
99
+ @command
100
+ end
97
101
  end
98
102
  end
99
103
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.10.0'.freeze
2
+ VERSION = '1.10.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_maintain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-01-29 00:00:00.000000000 Z
10
+ date: 2025-02-13 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: clamp
@@ -430,7 +429,6 @@ homepage: https://github.com/theforeman/foreman_maintain
430
429
  licenses:
431
430
  - GPL-3.0
432
431
  metadata: {}
433
- post_install_message:
434
432
  rdoc_options: []
435
433
  require_paths:
436
434
  - lib
@@ -448,8 +446,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
448
446
  - !ruby/object:Gem::Version
449
447
  version: '0'
450
448
  requirements: []
451
- rubygems_version: 3.3.27
452
- signing_key:
449
+ rubygems_version: 3.6.2
453
450
  specification_version: 4
454
451
  summary: Foreman maintenance tool belt
455
452
  test_files: []