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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6dc9fc4f6ffe918427ccd2908dd5287c69a171f
4
- data.tar.gz: a71c0003b5f061a2fd90669911a12a25fd16cd57
3
+ metadata.gz: 4c96d2ef33668a0de4240444ad0d18ef563592a0
4
+ data.tar.gz: 62900cd301e325db7380eaee0258e288b04ef312
5
5
  SHA512:
6
- metadata.gz: cf1fa36af6fba24ed87fe92b9a8949540efd197bef6ecb7866f1b60ade767ce989e4c528df659e54edb039d414083705286115ae4df830906ac8923a527dac00
7
- data.tar.gz: 9d4719a71c60837ab34d7971806c2af1a78b6af8365ce697f986821210dc8c4c77e10ea76477957afb095743a9c0221de999c8916245cccf58ac70451f262769
6
+ metadata.gz: f9376bb9dc47770ee071e21da5b28ab0deab4ea28ff5a8d86e4729757e641a57c7e4c7b9619d2f5a4089b924bdb159f34948a0da08c5d670f406411f7b83c261
7
+ data.tar.gz: 438f5870632818db2936c45d8be05737d6e8df13b87e091eb5f38b9e91de88e685d18324aa3ce736304912ce934827882817173e2211799f220cf6faf55bd9c7
@@ -10,3 +10,4 @@ require 'specinfra/backend/winrm'
10
10
  require 'specinfra/backend/shell_script'
11
11
  require 'specinfra/backend/dockerfile'
12
12
  require 'specinfra/backend/telnet'
13
+ require 'specinfra/backend/jexec'
@@ -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
@@ -25,6 +25,7 @@ module Specinfra
25
25
  :ssh_without_env,
26
26
  :dockerfile_finalizer,
27
27
  :telnet_options,
28
+ :jail_name,
28
29
  ].freeze
29
30
 
30
31
  def defaults
@@ -15,6 +15,8 @@ module Specinfra
15
15
  block_device
16
16
  user
17
17
  group
18
+ facter
19
+ ohai
18
20
  }
19
21
 
20
22
  include Enumerable
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.69.0"
2
+ VERSION = "2.70.0"
3
3
  end
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.69.0
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-14 00:00:00.000000000 Z
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