specinfra 0.5.9 → 0.6.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/base.rb +1 -1
- data/lib/specinfra/backend/lxc.rb +40 -0
- data/lib/specinfra/command/linux.rb +1 -1
- data/lib/specinfra/command/windows.rb +3 -3
- data/lib/specinfra/configuration.rb +2 -1
- data/lib/specinfra/helper.rb +1 -0
- data/lib/specinfra/helper/backend.rb +1 -1
- data/lib/specinfra/helper/lxc.rb +11 -0
- data/lib/specinfra/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b7d709f36935542a65418e095c59c7603e50fc6
|
4
|
+
data.tar.gz: 52eca55054a808e6b247a26662e29e54b3970bd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60739fc1cfb20beec8059cdc67114f6f2085f850776c53253e81a270316c5e3c8769a79ab8f7b8669ef9b0f664016aa2b62a71e6fee552ff80696aeeb09a020a
|
7
|
+
data.tar.gz: 3d71fc8140b48089ca4c4f25329c1a9835fcd5b137d881768e98552191465306a1587553a139a465e0be2e3ea8b3a677054b421cfe3537217572d44a1def2d23
|
data/lib/specinfra/backend.rb
CHANGED
@@ -5,6 +5,7 @@ require 'specinfra/backend/powershell/script_helper'
|
|
5
5
|
require 'specinfra/backend/powershell/command'
|
6
6
|
require 'specinfra/backend/cmd'
|
7
7
|
require 'specinfra/backend/docker'
|
8
|
+
require 'specinfra/backend/lxc'
|
8
9
|
require 'specinfra/backend/winrm'
|
9
10
|
require 'specinfra/backend/shellscript'
|
10
11
|
require 'specinfra/backend/dockerfile'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
module SpecInfra
|
3
|
+
module Backend
|
4
|
+
class Lxc < Exec
|
5
|
+
def run_command(cmd, opts={})
|
6
|
+
cmd = build_command(cmd)
|
7
|
+
cmd = add_pre_command(cmd)
|
8
|
+
out, ret = ct.execute do
|
9
|
+
out = `#{cmd}`
|
10
|
+
[out, $?.dup]
|
11
|
+
end
|
12
|
+
if @example
|
13
|
+
@example.metadata[:command] = cmd
|
14
|
+
@example.metadata[:stdout] = out
|
15
|
+
end
|
16
|
+
CommandResult.new :stdout => out, :exit_status => ret.exitstatus
|
17
|
+
end
|
18
|
+
def build_command(cmd)
|
19
|
+
cmd
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_pre_command(cmd)
|
23
|
+
cmd
|
24
|
+
end
|
25
|
+
|
26
|
+
def copy_file(from, to)
|
27
|
+
begin
|
28
|
+
FileUtils.cp(from, File.join(ct.config_item('lxc.rootfs'), to))
|
29
|
+
rescue => e
|
30
|
+
return false
|
31
|
+
end
|
32
|
+
true
|
33
|
+
end
|
34
|
+
|
35
|
+
def ct
|
36
|
+
@ct ||= ::LXC::Container.new(RSpec.configuration.lxc)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -43,7 +43,7 @@ module SpecInfra
|
|
43
43
|
exec cmd
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
def check_directory(dir)
|
48
48
|
cmd = item_has_attribute dir, 'Directory'
|
49
49
|
Backend::PowerShell::Command.new do
|
@@ -195,7 +195,7 @@ module SpecInfra
|
|
195
195
|
Backend::PowerShell::Command.new do
|
196
196
|
exec "(New-Object System.Net.NetworkInformation.Ping).send('#{host}').Status -eq 'Success'"
|
197
197
|
end
|
198
|
-
else
|
198
|
+
else
|
199
199
|
Backend::PowerShell::Command.new do
|
200
200
|
using 'is_remote_port_listening.ps1'
|
201
201
|
exec"(IsRemotePortListening -hostname #{host} -port #{port} -timeout #{timeout} -proto #{proto}) -eq $true"
|
@@ -204,7 +204,7 @@ module SpecInfra
|
|
204
204
|
end
|
205
205
|
|
206
206
|
def check_windows_feature_enabled(name,provider)
|
207
|
-
|
207
|
+
|
208
208
|
if provider.nil?
|
209
209
|
cmd = "@(ListWindowsFeatures -feature #{name}).count -gt 0"
|
210
210
|
else
|
data/lib/specinfra/helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module SpecInfra
|
2
2
|
module Helper
|
3
|
-
['Exec', 'Ssh', 'Cmd', 'Docker', 'WinRM', 'ShellScript', 'Dockerfile'].each do |type|
|
3
|
+
['Exec', 'Ssh', 'Cmd', 'Docker', 'WinRM', 'ShellScript', 'Dockerfile', 'Lxc'].each do |type|
|
4
4
|
eval <<-EOF
|
5
5
|
module #{type}
|
6
6
|
def backend(commands_object=nil)
|
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: 0.
|
4
|
+
version: 0.6.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: 2014-02-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/specinfra/backend/docker.rb
|
87
87
|
- lib/specinfra/backend/dockerfile.rb
|
88
88
|
- lib/specinfra/backend/exec.rb
|
89
|
+
- lib/specinfra/backend/lxc.rb
|
89
90
|
- lib/specinfra/backend/powershell/command.rb
|
90
91
|
- lib/specinfra/backend/powershell/script_helper.rb
|
91
92
|
- lib/specinfra/backend/powershell/support/check_file_access_rules.ps1
|
@@ -125,6 +126,7 @@ files:
|
|
125
126
|
- lib/specinfra/helper/configuration.rb
|
126
127
|
- lib/specinfra/helper/detect_os.rb
|
127
128
|
- lib/specinfra/helper/docker.rb
|
129
|
+
- lib/specinfra/helper/lxc.rb
|
128
130
|
- lib/specinfra/helper/os.rb
|
129
131
|
- lib/specinfra/helper/properties.rb
|
130
132
|
- lib/specinfra/properties.rb
|