ood_core 0.27.0 → 0.27.1

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: 6aafe5b9d84b0b825241691c28be26cbce7402534e0ac1555a033191d13a7a1a
4
- data.tar.gz: f214cbaf84997e4c27dc184f3b3a12cfc82e510c5d6eb7b9ccdfb5df0b164089
3
+ metadata.gz: c4cf552caaaedcb74de1091d8e9d1503b21f140b961ea8ccc3e53c1a25fa88f9
4
+ data.tar.gz: e69ec942c413e569d232ed8e88ee9a0abb79d5f3e9c7bf2d17cce7d3fe92b465
5
5
  SHA512:
6
- metadata.gz: d1cc480563eaffcafeaf68b09ec55e5cec02d2c610b7264e45c0c0f0d830ac11e62a9b91fe395a00140c38b8bc5b01390e52d4dc8d962579fee0cf7ff33c6fc3
7
- data.tar.gz: 68d5c95f5a4d87ab89cd5938d92c2d186398701942fd8a460409e5f5864b9eccedcb8ac8668d211dc0318886e6978aa0528371ede004466f0b9dcf7bc2a95118
6
+ metadata.gz: 72e629a77d117b4c370947e72eddc96ebddf766eff5d0459c5291074ab22033ded29e032563e00112051d0ef122e36bf4beca3e81ff94d9f5e9cd5c6576939a8
7
+ data.tar.gz: 61a4b4d3208796c7b4e365307fd527b081e5eb1be3fbebe02272883a3b7efafbb45c31234300dbe517f2eadc576b3cb4dc11fd91615f706704396541984c91bd
@@ -372,10 +372,14 @@ module OodCore
372
372
  hsh[:AllowAccounts].to_s.split(',')
373
373
  end
374
374
 
375
-
376
375
  hsh[:deny_accounts] = hsh[:DenyAccounts].nil? ? [] : hsh[:DenyAccounts].to_s.split(',')
377
- hsh[:tres] = hsh[:TRES].nil? ? {} : hsh[:TRES].to_s.split(',').map { |str| str.split('=') }.to_h
378
376
 
377
+ hsh[:tres] = case hsh[:TRES]
378
+ when nil, '(null)', ''
379
+ {}
380
+ else
381
+ hsh[:TRES].to_s.split(',').map { |str| str.split('=') }.to_h
382
+ end
379
383
  OodCore::Job::QueueInfo.new(**hsh)
380
384
  end
381
385
 
@@ -10,7 +10,7 @@ require 'time'
10
10
  # @api private
11
11
  class OodCore::Job::Adapters::LinuxSystemd::Launcher
12
12
  attr_reader :debug, :site_timeout, :session_name_label, :ssh_hosts,
13
- :strict_host_checking, :username
13
+ :strict_host_checking, :username, :ssh_keyfile
14
14
  # The root exception class that all LinuxSystemd adapter-specific exceptions inherit
15
15
  # from
16
16
  class Error < StandardError; end
@@ -26,6 +26,7 @@ class OodCore::Job::Adapters::LinuxSystemd::Launcher
26
26
  ssh_hosts:,
27
27
  strict_host_checking: false,
28
28
  submit_host:,
29
+ ssh_keyfile: "",
29
30
  **_
30
31
  )
31
32
  @debug = !! debug
@@ -35,6 +36,7 @@ class OodCore::Job::Adapters::LinuxSystemd::Launcher
35
36
  @strict_host_checking = strict_host_checking
36
37
  @submit_host = submit_host
37
38
  @username = Etc.getlogin
39
+ @ssh_keyfile = ssh_keyfile
38
40
  end
39
41
 
40
42
  # @param hostname [#to_s] The hostname to submit the work to
@@ -97,27 +99,27 @@ class OodCore::Job::Adapters::LinuxSystemd::Launcher
97
99
  # if ! strict_host_checking
98
100
  # -o UserKnownHostsFile=/dev/null (do not update the user's known hosts file)
99
101
  # -o StrictHostKeyChecking=no (do no check the user's known hosts file)
102
+ # if ssh_keyfile
103
+ # -i ssh_keyfile (Use this keyfile location)
100
104
  #
101
105
  # @param destination_host [#to_s] the destination host you wish to ssh into
102
106
  # @param cmd [Array<#to_s>] the command to be executed on the destination host
103
107
  def ssh_cmd(destination_host, cmd)
104
- if strict_host_checking
105
- [
106
- 'ssh', '-t',
107
- '-p', OodCore::Job::Adapters::Helper.ssh_port,
108
- '-o', 'BatchMode=yes',
109
- "#{username}@#{destination_host}"
110
- ].concat(cmd)
111
- else
112
- [
113
- 'ssh', '-t',
114
- '-p', OodCore::Job::Adapters::Helper.ssh_port,
115
- '-o', 'BatchMode=yes',
116
- '-o', 'UserKnownHostsFile=/dev/null',
117
- '-o', 'StrictHostKeyChecking=no',
118
- "#{username}@#{destination_host}"
119
- ].concat(cmd)
120
- end
108
+
109
+ sshcmd = [
110
+ 'ssh', '-t',
111
+ '-p', OodCore::Job::Adapters::Helper.ssh_port,
112
+ '-o', 'Batchmode=yes',
113
+ ]
114
+
115
+ sshcmd.concat([
116
+ '-o','StrictHostKeyChecking=no',
117
+ '-o','UserKnownHostsFile=/dev/null',
118
+ ]) unless strict_host_checking
119
+
120
+ sshcmd.concat(['-i',ssh_keyfile.to_s,]) unless ssh_keyfile.to_s.empty?
121
+
122
+ sshcmd.concat(["#{username}@#{destination_host}"]).concat(cmd)
121
123
  end
122
124
 
123
125
  def shell
@@ -15,6 +15,7 @@ module OodCore
15
15
  # @option config [Object] :ssh_hosts (nil) The list of permissable hosts, defaults to :submit_host
16
16
  # @option config [Object] :strict_host_checking (true) Set to false to disable strict host checking and updating the known_hosts file
17
17
  # @option config [Object] :submit_host The SSH target to connect to, may be the head of a round-robin
18
+ # @option config [Object] :ssh_keyfile The SSH Key file to use as identity.
18
19
  def self.build_systemd(config)
19
20
  c = config.to_h.symbolize_keys
20
21
  debug = c.fetch(:debug, false)
@@ -22,6 +23,7 @@ module OodCore
22
23
  ssh_hosts = c.fetch(:ssh_hosts, [c[:submit_host]])
23
24
  strict_host_checking = c.fetch(:strict_host_checking, true)
24
25
  submit_host = c[:submit_host]
26
+ ssh_keyfile = c.fetch(:ssh_keyfile, "")
25
27
 
26
28
  Adapters::LinuxSystemd.new(
27
29
  ssh_hosts: ssh_hosts,
@@ -31,6 +33,7 @@ module OodCore
31
33
  ssh_hosts: ssh_hosts,
32
34
  strict_host_checking: strict_host_checking,
33
35
  submit_host: submit_host,
36
+ ssh_keyfile: ssh_keyfile,
34
37
  )
35
38
  )
36
39
  end
@@ -1,4 +1,4 @@
1
1
  module OodCore
2
2
  # The current version of {OodCore}
3
- VERSION = "0.27.0"
3
+ VERSION = "0.27.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ood_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.27.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Franz
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2024-12-18 00:00:00.000000000 Z
13
+ date: 2025-02-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ood_support