specinfra 2.69.0 → 2.70.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/specinfra/backend.rb +1 -0
- data/lib/specinfra/backend/jexec.rb +47 -0
- data/lib/specinfra/configuration.rb +1 -0
- data/lib/specinfra/host_inventory.rb +2 -0
- data/lib/specinfra/host_inventory/facter.rb +17 -0
- data/lib/specinfra/host_inventory/ohai.rb +21 -0
- data/lib/specinfra/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c96d2ef33668a0de4240444ad0d18ef563592a0
|
4
|
+
data.tar.gz: 62900cd301e325db7380eaee0258e288b04ef312
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9376bb9dc47770ee071e21da5b28ab0deab4ea28ff5a8d86e4729757e641a57c7e4c7b9619d2f5a4089b924bdb159f34948a0da08c5d670f406411f7b83c261
|
7
|
+
data.tar.gz: 438f5870632818db2936c45d8be05737d6e8df13b87e091eb5f38b9e91de88e685d18324aa3ce736304912ce934827882817173e2211799f220cf6faf55bd9c7
|
data/lib/specinfra/backend.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
module Specinfra
|
2
|
+
module Backend
|
3
|
+
class Jexec < Exec
|
4
|
+
def initialize(config = {})
|
5
|
+
super(config)
|
6
|
+
jname = get_config(:jail_name)
|
7
|
+
jroot = `jls -j #{jname} path`.strip
|
8
|
+
fail 'fail to get jail path!' if jroot.to_s.empty?
|
9
|
+
set_config(:jail_root, jroot)
|
10
|
+
end
|
11
|
+
|
12
|
+
def send_file(from, to)
|
13
|
+
jroot = get_config(:jail_root)
|
14
|
+
FileUtils.cp(from, "#{jroot}/#{to}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def send_directory(from, to)
|
18
|
+
jroot = get_config(:jail_root)
|
19
|
+
FileUtils.cp_r("#{jroot}/#{from}", to)
|
20
|
+
end
|
21
|
+
|
22
|
+
def build_command(cmd)
|
23
|
+
shell = get_config(:shell) || '/bin/sh'
|
24
|
+
cmd = cmd.shelljoin if cmd.is_a?(Array)
|
25
|
+
shell = shell.shellescape
|
26
|
+
|
27
|
+
if get_config(:interactive_shell)
|
28
|
+
shell << " -i"
|
29
|
+
end
|
30
|
+
|
31
|
+
if get_config(:login_shell)
|
32
|
+
shell << " -l"
|
33
|
+
end
|
34
|
+
|
35
|
+
cmd = "#{shell} -c #{cmd.to_s.shellescape}"
|
36
|
+
|
37
|
+
path = get_config(:path)
|
38
|
+
if path
|
39
|
+
cmd = %Q{env PATH="#{path}" #{cmd}}
|
40
|
+
end
|
41
|
+
|
42
|
+
jname = get_config(:jail_name)
|
43
|
+
"jexec #{jname} #{cmd}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Specinfra
|
2
|
+
class HostInventory
|
3
|
+
class Facter < Base
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
def get
|
7
|
+
begin
|
8
|
+
ret = backend.run_command('facter --puppet --yaml')
|
9
|
+
rescue StandardError
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
|
13
|
+
ret.exit_status.zero? ? YAML.load(ret.stdout) : nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Specinfra
|
2
|
+
class HostInventory
|
3
|
+
class Ohai < Base
|
4
|
+
def get
|
5
|
+
begin
|
6
|
+
require 'json'
|
7
|
+
rescue LoadError
|
8
|
+
return nil
|
9
|
+
end
|
10
|
+
|
11
|
+
begin
|
12
|
+
ret = backend.run_command('ohai --log_level error')
|
13
|
+
rescue StandardError
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
|
17
|
+
ret.exit_status.zero? ? JSON.parse(ret.stdout) : nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/specinfra/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.70.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|
@@ -180,6 +180,7 @@ files:
|
|
180
180
|
- lib/specinfra/backend/docker.rb
|
181
181
|
- lib/specinfra/backend/dockerfile.rb
|
182
182
|
- lib/specinfra/backend/exec.rb
|
183
|
+
- lib/specinfra/backend/jexec.rb
|
183
184
|
- lib/specinfra/backend/lxc.rb
|
184
185
|
- lib/specinfra/backend/powershell/command.rb
|
185
186
|
- lib/specinfra/backend/powershell/script_helper.rb
|
@@ -503,12 +504,14 @@ files:
|
|
503
504
|
- lib/specinfra/host_inventory/cpu.rb
|
504
505
|
- lib/specinfra/host_inventory/domain.rb
|
505
506
|
- lib/specinfra/host_inventory/ec2.rb
|
507
|
+
- lib/specinfra/host_inventory/facter.rb
|
506
508
|
- lib/specinfra/host_inventory/filesystem.rb
|
507
509
|
- lib/specinfra/host_inventory/fqdn.rb
|
508
510
|
- lib/specinfra/host_inventory/group.rb
|
509
511
|
- lib/specinfra/host_inventory/hostname.rb
|
510
512
|
- lib/specinfra/host_inventory/kernel.rb
|
511
513
|
- lib/specinfra/host_inventory/memory.rb
|
514
|
+
- lib/specinfra/host_inventory/ohai.rb
|
512
515
|
- lib/specinfra/host_inventory/platform.rb
|
513
516
|
- lib/specinfra/host_inventory/platform_version.rb
|
514
517
|
- lib/specinfra/host_inventory/user.rb
|