hammer_cli_foreman_virt_who_configure 0.0.2 → 0.0.7

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
- SHA1:
3
- metadata.gz: ecdea9651c9394fb0c25d8e8a5ef3c4f1b0f76d8
4
- data.tar.gz: b77f189652ccb32625a5253d7bf2c7a586ffcb73
2
+ SHA256:
3
+ metadata.gz: 845377dff0db8f196099f05ed594c4bbdd4b33aa9f44dcd9fb42745e12e778d5
4
+ data.tar.gz: d3170a6efee5bed8b717986a0fc36d23a178f391357dcd01dbcb07ec56634a85
5
5
  SHA512:
6
- metadata.gz: c6aedf1fd3aa8ac0699677d0828277a4159eca2633646b918a746675d848fb5376ceb27f20352f4bf45ea04a3287278a1f5e5d04ee4489ae23a347df63b9dfe2
7
- data.tar.gz: 21fc3fa9187326288be6480f4fc44a0ccf62922ba1ebb7c4ec85928cdbd2137a2328f9ddac8b21188e3548aac66d914bb6ee4d88b16a9b1dcd2716df16a5890f
6
+ metadata.gz: f0c9a9013c306d41ecde2c2be58608b98a95d725d0d42e7aeff0d4656b951fa01916fc0183f74ea15f1fc70c6f3e4b1f6be916189eb7feaae5599d55e3317371
7
+ data.tar.gz: 51490292ea0e37bb750a2385b3780d69b124e68e269e1d21926f1243fd06a85cdba1ca89c94856809fe2e67680822f5080f5dd3a05f5a22601be85be956f0f86
@@ -69,7 +69,6 @@ module HammerCLIForemanVirtWhoConfigure
69
69
  field :hypervisor_type, _('Hypervisor type')
70
70
  field :hypervisor_server, _('Hypervisor server')
71
71
  field :hypervisor_username, _('Hypervisor username')
72
- field :hypervisor_password, _('Hypervisor password')
73
72
  field :_status, _('Status')
74
73
  end
75
74
  label _('Schedule') do
@@ -82,9 +81,17 @@ module HammerCLIForemanVirtWhoConfigure
82
81
  field :_filtering_mode, _('Filtering')
83
82
  field :blacklist, _('Excluded hosts'), Fields::Field, :hide_blank => true
84
83
  field :whitelist, _('Filtered hosts'), Fields::Field, :hide_blank => true
84
+ field :filter_host_parents, _('Filter host parents'), Fields::Field, :hide_blank => true
85
+ field :exclude_host_parents, _('Exclude host parents'), Fields::Field, :hide_blank => true
85
86
  field :debug, _('Debug mode'), Fields::Boolean
86
- field :proxy, _('HTTP proxy')
87
- field :no_proxy, _('Ignore proxy')
87
+ field :no_proxy, _('Ignore proxy'), Fields::Field, :hide_blank => true
88
+ end
89
+ label _('HTTP Proxy') do
90
+ from :http_proxy do
91
+ field :id, _('HTTP proxy ID'), Fields::Field, :hide_blank => true
92
+ field :name, _('HTTP proxy name'), Fields::Field, :hide_blank => true
93
+ field :url, _('HTTP proxy URL'), Fields::Field, :hide_blank => true
94
+ end
88
95
  end
89
96
  HammerCLIForeman::References.taxonomies(self)
90
97
  end
@@ -116,7 +123,7 @@ module HammerCLIForemanVirtWhoConfigure
116
123
 
117
124
  failure_message _('Could not fetch the Virt Who configuration')
118
125
 
119
- option ['--output', '-o'], 'FILE', _('File where the script will be written.')
126
+ option ['-o', '--output'], 'FILE', _('File where the script will be written')
120
127
 
121
128
  def execute
122
129
  data = send_request
@@ -1,15 +1,27 @@
1
1
  module HammerCLIForemanVirtWhoConfigure
2
2
  class SystemCaller
3
+ WHITELISTED_VARS = %w[HOME USER LANG].freeze
4
+
3
5
  def initialize(tempfile = nil)
4
6
  @tempfile = tempfile || Tempfile.new('virt_who')
5
7
  end
6
8
 
7
- def system(commad)
9
+ def clean_env_vars
10
+ # Cleaning ENV vars and keeping required vars only because,
11
+ # When using SCL it adds GEM_HOME and GEM_PATH ENV vars.
12
+ # These vars break foreman-maintain tool.
13
+ # This way we use system ruby to execute the bash script.
14
+ cleaned_env = ENV.select { |var| WHITELISTED_VARS.include?(var) || var.start_with?('LC_') }
15
+ cleaned_env['PATH'] = '/sbin:/bin:/usr/sbin:/usr/bin'
16
+ cleaned_env
17
+ end
18
+
19
+ def system(command)
8
20
  result = nil
9
21
  begin
10
- @tempfile.write(commad)
22
+ @tempfile.write(command)
11
23
  @tempfile.flush # to make sure the command is complete
12
- result = Kernel.system("/usr/bin/bash #{@tempfile.path}")
24
+ result = Kernel.system(clean_env_vars, "/usr/bin/bash #{@tempfile.path}", unsetenv_others: true)
13
25
  ensure
14
26
  @tempfile.close
15
27
  @tempfile.unlink
@@ -1,5 +1,5 @@
1
1
  module HammerCLIForemanVirtWhoConfigure
2
2
  def self.version
3
- @version ||= Gem::Version.new '0.0.2'
3
+ @version ||= Gem::Version.new '0.0.7'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman_virt_who_configure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomáš Strachota
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-02 00:00:00.000000000 Z
11
+ date: 2020-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hammer_cli
@@ -76,9 +76,9 @@ files:
76
76
  - test/functional/test_helper.rb
77
77
  - test/test_helper.rb
78
78
  - test/unit/system_caller_test.rb
79
- homepage: http://github.com/theforeman/hammer-cli-foreman-virt-who-configure
79
+ homepage: https://github.com/theforeman/hammer-cli-foreman-virt-who-configure
80
80
  licenses:
81
- - GPL v3+
81
+ - GPL-3.0+
82
82
  metadata: {}
83
83
  post_install_message:
84
84
  rdoc_options: []
@@ -95,19 +95,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  requirements: []
98
- rubyforge_project:
99
- rubygems_version: 2.5.1
98
+ rubygems_version: 3.1.4
100
99
  signing_key:
101
100
  specification_version: 4
102
101
  summary: Plugin for configuring Virt Who
103
102
  test_files:
104
- - test/data/1.15/foreman_api.json
105
- - test/functional/config/config_create_test.rb
106
- - test/functional/config/config_deploy_test.rb
107
- - test/functional/config/config_list_test.rb
103
+ - test/functional/config/config_info_test.rb
108
104
  - test/functional/config/config_update_test.rb
105
+ - test/functional/config/config_list_test.rb
106
+ - test/functional/config/config_deploy_test.rb
109
107
  - test/functional/config/config_fetch_test.rb
110
- - test/functional/config/config_info_test.rb
108
+ - test/functional/config/config_create_test.rb
111
109
  - test/functional/test_helper.rb
112
- - test/test_helper.rb
113
110
  - test/unit/system_caller_test.rb
111
+ - test/test_helper.rb
112
+ - test/data/1.15/foreman_api.json