foreman_remote_execution 6.1.0 → 6.2.0

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: 910d4fd508188efbad4cfb121085171d077d65881e7ef8b5c9f1dea4092aa182
4
- data.tar.gz: af7a5ca195d2b0d6ba269962bb3d726cd19dd6cc23358e6e6dc21cc77b36b3b2
3
+ metadata.gz: 71b09dd41d7ce39e709e4a45c2c78926d53151ed3625fcf2f4e0d739853cae8e
4
+ data.tar.gz: d01463507ceb52b52f661fa9a55ce413e2f824d74dfe50958063359f5a6fa8e9
5
5
  SHA512:
6
- metadata.gz: 030ed44dd17a6da7b334f3c3621d34cec9d4afc6323f2cbacd1054716520dc4f955f5da4d0aa5bfb93b0f83699c6dd15a3d75a9ff770fa1b9c5d6df2afbba440
7
- data.tar.gz: 80d41c53f5e1620919069e08a97b23d22d884406275ad426b49ee08c97dc92c958762fe79ff5bb703b63859f1551fb3cfad838f1b63e75cbc143983dc864e7fd
6
+ metadata.gz: 2840a0f11ef02ba63f3a981075eae66e50e5fa0f7738518c3bf3a74f0bf5b7cf6be3273c2ebb999d00174244fb73295b3d0f8c74b663ef9839a91a16ad9c9878
7
+ data.tar.gz: 79a0dad8442b9135995a8bcbf62dfde4e112cd765950b61f45db0c490eac0d21e3cf843aea946c2450f69ab8f4d098fe26927b4eafe4cd0b7d6a1097ba04ceb9
@@ -102,7 +102,7 @@ module ForemanRemoteExecution
102
102
  end
103
103
 
104
104
  def remote_execution_ssh_keys
105
- remote_execution_proxies('SSH', false).values.flatten.uniq.map { |proxy| proxy.pubkey }.compact.uniq
105
+ remote_execution_proxies(%w(SSH Script), false).values.flatten.uniq.map { |proxy| proxy.pubkey }.compact.uniq
106
106
  end
107
107
 
108
108
  def drop_execution_interface_cache
@@ -11,7 +11,7 @@ module ForemanRemoteExecution
11
11
  end
12
12
 
13
13
  def update_pubkey
14
- return unless has_feature?('SSH')
14
+ return unless has_feature?(%w(SSH Script))
15
15
 
16
16
  key = ::ProxyAPI::RemoteExecutionSSH.new(:url => url).pubkey
17
17
  self.update_attribute(:pubkey, key) if key
@@ -217,7 +217,7 @@ class JobInvocationComposer
217
217
  def format_datetime(datetime)
218
218
  return datetime if datetime.blank?
219
219
 
220
- Time.parse(datetime).utc.strftime('%Y-%m-%d %H:%M')
220
+ Time.parse(datetime).in_time_zone.strftime('%Y-%m-%d %H:%M')
221
221
  end
222
222
  end
223
223
 
@@ -37,8 +37,7 @@ class ScriptExecutionProvider < RemoteExecutionProvider
37
37
  end
38
38
 
39
39
  def ssh_params(host)
40
- proxy_selector = ::RemoteExecutionProxySelector.new
41
- proxy = proxy_selector.determine_proxy(host, 'SSH')
40
+ proxy = proxy_for_cockpit(host)
42
41
  {
43
42
  :hostname => find_ip_or_hostname(host),
44
43
  :proxy => proxy.class == Symbol ? proxy : proxy.url,
@@ -54,7 +53,7 @@ class ScriptExecutionProvider < RemoteExecutionProvider
54
53
  end
55
54
 
56
55
  def proxy_feature
57
- 'SSH'
56
+ %w(SSH Script)
58
57
  end
59
58
 
60
59
  private
@@ -66,6 +65,14 @@ class ScriptExecutionProvider < RemoteExecutionProvider
66
65
  def ssh_port(host)
67
66
  Integer(host_setting(host, :remote_execution_ssh_port))
68
67
  end
68
+
69
+ def proxy_for_cockpit(host)
70
+ proxy_selector = ::RemoteExecutionProxySelector.new
71
+ proxy = proxy_selector.determine_proxy(host, 'Script', capability: 'cockpit')
72
+ return proxy unless [:not_defined, :not_available, nil].include?(proxy)
73
+
74
+ proxy_selector.determine_proxy(host, 'SSH')
75
+ end
69
76
  end
70
77
  end
71
78
 
@@ -7,7 +7,7 @@ class DefaultProxyProxySelector < ::RemoteExecutionProxySelector
7
7
  super
8
8
  end
9
9
 
10
- def available_proxies(host, provider)
10
+ def available_proxies(host, provider, capability: nil)
11
11
  # TODO: Once we have a internal proxy marker/feature on the proxy, we can
12
12
  # swap the implementation
13
13
  raise _('default_capsule method missing from SmartProxy') unless ::SmartProxy.respond_to?(:default_capsule)
@@ -2,7 +2,12 @@ class RemoteExecutionProxySelector < ::ForemanTasks::ProxySelector
2
2
 
3
3
  INTERNAL_PROXY = 'internal'.freeze
4
4
 
5
- def available_proxies(host, provider)
6
- host.remote_execution_proxies(provider)
5
+ def available_proxies(host, provider, capability: nil)
6
+ proxies = host.remote_execution_proxies(provider)
7
+ return proxies if capability.nil?
8
+
9
+ proxies.reduce({}) do |acc, (strategy, possible_proxies)|
10
+ acc.merge(strategy => possible_proxies.select { |proxy| proxy.has_capability?(capability) })
11
+ end
7
12
  end
8
13
  end
@@ -1,2 +1,5 @@
1
1
  f = Feature.where(:name => 'SSH').first_or_create
2
2
  raise "Unable to create proxy feature: #{format_errors f}" if f.nil? || f.errors.any?
3
+
4
+ f = Feature.where(:name => 'Script').first_or_create
5
+ raise "Unable to create proxy feature: #{format_errors f}" if f.nil? || f.errors.any?
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '6.1.0'.freeze
2
+ VERSION = '6.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_remote_execution
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Remote Execution team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-31 00:00:00.000000000 Z
11
+ date: 2022-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -545,7 +545,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
545
545
  - !ruby/object:Gem::Version
546
546
  version: '0'
547
547
  requirements: []
548
- rubygems_version: 3.2.26
548
+ rubygems_version: 3.1.4
549
549
  signing_key:
550
550
  specification_version: 4
551
551
  summary: A plugin bringing remote execution to the Foreman, completing the config