pennyworth-tool 0.0.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 +7 -0
- data/.gitignore +8 -0
- data/.hound.yml +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +18 -0
- data/CONTRIBUTING.md +67 -0
- data/COPYING +674 -0
- data/Gemfile +28 -0
- data/README.md +339 -0
- data/Rakefile +33 -0
- data/bin/pennyworth +26 -0
- data/config/setup.yml +17 -0
- data/examples/README.md +23 -0
- data/examples/kiwi/definitions/base_opensuse13.1_kvm/config.sh +87 -0
- data/examples/kiwi/definitions/base_opensuse13.1_kvm/config.xml +64 -0
- data/examples/kiwi/definitions/base_opensuse13.1_kvm/root/etc/sysconfig/network/ifcfg-eth0 +2 -0
- data/examples/kiwi/definitions/base_opensuse13.1_kvm/root/home/vagrant/.ssh/authorized_keys +1 -0
- data/examples/vagrant/Vagrantfile +14 -0
- data/files/99-libvirt.rules +2 -0
- data/files/image_test-template.xml +43 -0
- data/files/pool-default.xml +6 -0
- data/lib/image_runner.rb +89 -0
- data/lib/pennyworth.rb +65 -0
- data/lib/pennyworth/cli.rb +339 -0
- data/lib/pennyworth/cli_host_controller.rb +107 -0
- data/lib/pennyworth/commands/base_command.rb +96 -0
- data/lib/pennyworth/commands/boot_command.rb +29 -0
- data/lib/pennyworth/commands/build_base_command.rb +103 -0
- data/lib/pennyworth/commands/command.rb +43 -0
- data/lib/pennyworth/commands/down_command.rb +25 -0
- data/lib/pennyworth/commands/import_base_command.rb +112 -0
- data/lib/pennyworth/commands/import_ssh_keys_command.rb +27 -0
- data/lib/pennyworth/commands/list_command.rb +41 -0
- data/lib/pennyworth/commands/setup_command.rb +209 -0
- data/lib/pennyworth/commands/shutdown_command.rb +28 -0
- data/lib/pennyworth/commands/status_command.rb +26 -0
- data/lib/pennyworth/commands/up_command.rb +27 -0
- data/lib/pennyworth/exceptions.rb +39 -0
- data/lib/pennyworth/helper.rb +39 -0
- data/lib/pennyworth/host_config.rb +86 -0
- data/lib/pennyworth/host_runner.rb +133 -0
- data/lib/pennyworth/image_runner.rb +89 -0
- data/lib/pennyworth/libvirt.rb +93 -0
- data/lib/pennyworth/local_command_runner.rb +77 -0
- data/lib/pennyworth/local_runner.rb +34 -0
- data/lib/pennyworth/lock_service.rb +87 -0
- data/lib/pennyworth/remote_command_runner.rb +144 -0
- data/lib/pennyworth/runner.rb +27 -0
- data/lib/pennyworth/settings.rb +42 -0
- data/lib/pennyworth/spec.rb +96 -0
- data/lib/pennyworth/spec_profiler.rb +85 -0
- data/lib/pennyworth/ssh_keys_importer.rb +107 -0
- data/lib/pennyworth/urls.rb +28 -0
- data/lib/pennyworth/vagrant.rb +81 -0
- data/lib/pennyworth/vagrant_command.rb +120 -0
- data/lib/pennyworth/vagrant_runner.rb +44 -0
- data/lib/pennyworth/version.rb +22 -0
- data/lib/pennyworth/vm.rb +62 -0
- data/man/.gitignore +2 -0
- data/man/pennyworth.1.md +28 -0
- data/pennyworth.gemspec +57 -0
- data/prophet/Gemfile +3 -0
- data/prophet/prophet.rb +82 -0
- data/spec/base_command_spec.rb +30 -0
- data/spec/build_base_command_spec.rb +147 -0
- data/spec/cli_host_controller_spec.rb +113 -0
- data/spec/data/hosts.yaml +10 -0
- data/spec/data/kiwi/base_opensuse12.3_kvm.box +1 -0
- data/spec/data/kiwi/base_opensuse13.1_kvm.box +1 -0
- data/spec/data/kiwi/definitions/base_opensuse12.3_kvm/config.sh +1 -0
- data/spec/data/kiwi/definitions/base_opensuse12.3_kvm/config.xml +1 -0
- data/spec/data/kiwi/definitions/base_opensuse12.3_kvm/root/home/vagrant/.ssh/authorized_keys +1 -0
- data/spec/data/kiwi/definitions/base_opensuse13.1_kvm/config.sh +1 -0
- data/spec/data/kiwi/definitions/base_opensuse13.1_kvm/config.xml +1 -0
- data/spec/data/kiwi/definitions/base_opensuse13.1_kvm/root/home/vagrant/.ssh/authorized_keys +1 -0
- data/spec/data/kiwi2/box_state.yaml +14 -0
- data/spec/data/kiwi2/definitions/base_opensuse12.3_kvm/config.sh +1 -0
- data/spec/data/kiwi2/definitions/base_opensuse12.3_kvm/config.xml +1 -0
- data/spec/data/kiwi2/definitions/base_opensuse12.3_kvm/root/home/vagrant/.ssh/authorized_keys +1 -0
- data/spec/data/kiwi2/definitions/base_opensuse13.1_kvm/config.sh +1 -0
- data/spec/data/kiwi2/definitions/base_opensuse13.1_kvm/config.xml +1 -0
- data/spec/data/kiwi2/definitions/base_opensuse13.1_kvm/root/home/vagrant/.ssh/authorized_keys +1 -0
- data/spec/data/kiwi3/box_state.yaml +13 -0
- data/spec/data/kiwi3/definitions/base_opensuse12.3_kvm/.gitkeep +0 -0
- data/spec/data/kiwi3/definitions/base_opensuse13.1_kvm/.gitkeep +0 -0
- data/spec/data/kiwi3/import_state.yaml +3 -0
- data/spec/data/kiwi4/definitions/base_opensuse12.3_kvm/.gitkeep +0 -0
- data/spec/data/kiwi4/definitions/base_opensuse13.1_kvm/.gitkeep +0 -0
- data/spec/data/kiwi4/import_state.yaml +3 -0
- data/spec/data/kiwi5/import_state.yaml +3 -0
- data/spec/data/vagrant/.gitkeep +0 -0
- data/spec/host_config_spec.rb +197 -0
- data/spec/host_runner_spec.rb +112 -0
- data/spec/image_runner_spec.rb +62 -0
- data/spec/import_base_command_spec.rb +189 -0
- data/spec/local_command_runner_spec.rb +117 -0
- data/spec/local_runner_spec.rb +42 -0
- data/spec/lock_service_spec.rb +95 -0
- data/spec/remote_command_runner_spec.rb +115 -0
- data/spec/settings_spec.rb +26 -0
- data/spec/setup_command_spec.rb +49 -0
- data/spec/spec_helper.rb +50 -0
- data/spec/spec_profiler_spec.rb +63 -0
- data/spec/spec_spec.rb +99 -0
- data/spec/support/command_runner_examples.rb +29 -0
- data/spec/support/runner_examples.rb +34 -0
- data/spec/urls_spec.rb +46 -0
- data/spec/vagrant_command_spec.rb +51 -0
- data/spec/vagrant_runner_spec.rb +40 -0
- data/spec/vagrant_spec.rb +288 -0
- data/spec/vm_spec.rb +56 -0
- metadata +257 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Copyright (c) 2013-2014 SUSE LLC
|
|
2
|
+
#
|
|
3
|
+
# This program is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of version 3 of the GNU General Public License as
|
|
5
|
+
# published by the Free Software Foundation.
|
|
6
|
+
#
|
|
7
|
+
# This program is distributed in the hope that it will be useful,
|
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10
|
+
# GNU General Public License for more details.
|
|
11
|
+
#
|
|
12
|
+
# You should have received a copy of the GNU General Public License
|
|
13
|
+
# along with this program; if not, contact SUSE LLC.
|
|
14
|
+
#
|
|
15
|
+
# To contact SUSE about this file by physical or electronic mail,
|
|
16
|
+
# you may find current contact information at www.suse.com
|
|
17
|
+
|
|
18
|
+
require 'spec_helper'
|
|
19
|
+
|
|
20
|
+
describe Pennyworth::VagrantRunner do
|
|
21
|
+
let(:runner) { Pennyworth::VagrantRunner.new("foo", RSpec.configuration.vagrant_dir, "root") }
|
|
22
|
+
|
|
23
|
+
it_behaves_like "a runner"
|
|
24
|
+
|
|
25
|
+
describe "#start" do
|
|
26
|
+
it "returns the IP address of the started system" do
|
|
27
|
+
expect_any_instance_of(Pennyworth::Vagrant).to receive(:run).with("destroy", "foo")
|
|
28
|
+
expect_any_instance_of(Pennyworth::Vagrant).to receive(:run).with("up", "foo")
|
|
29
|
+
expect_any_instance_of(Pennyworth::Vagrant).to receive(:ssh_config).with("foo") {
|
|
30
|
+
{
|
|
31
|
+
"foo" => {
|
|
32
|
+
"HostName" => "1.2.3.4"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
expect(runner.start).to eq("1.2.3.4")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# Copyright (c) 2013-2014 SUSE LLC
|
|
2
|
+
#
|
|
3
|
+
# This program is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of version 3 of the GNU General Public License as
|
|
5
|
+
# published by the Free Software Foundation.
|
|
6
|
+
#
|
|
7
|
+
# This program is distributed in the hope that it will be useful,
|
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10
|
+
# GNU General Public License for more details.
|
|
11
|
+
#
|
|
12
|
+
# You should have received a copy of the GNU General Public License
|
|
13
|
+
# along with this program; if not, contact SUSE LLC.
|
|
14
|
+
#
|
|
15
|
+
# To contact SUSE about this file by physical or electronic mail,
|
|
16
|
+
# you may find current contact information at www.suse.com
|
|
17
|
+
|
|
18
|
+
require "spec_helper"
|
|
19
|
+
|
|
20
|
+
describe Pennyworth::Vagrant do
|
|
21
|
+
describe "#ssh_config" do
|
|
22
|
+
def unindent(s)
|
|
23
|
+
indent = " " * (s.split("\n").map { |l| l.match(/^\s*/)[0].size }.min || 0)
|
|
24
|
+
s.gsub(/^#{indent}/, "")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
subject { Pennyworth::Vagrant.new("/tmp") }
|
|
28
|
+
|
|
29
|
+
let(:vagrant_ssh_config_output_one) {
|
|
30
|
+
unindent(<<-EOT)
|
|
31
|
+
Host one
|
|
32
|
+
HostName 192.168.122.1
|
|
33
|
+
User vagrant
|
|
34
|
+
Port 22
|
|
35
|
+
UserKnownHostsFile /dev/null
|
|
36
|
+
StrictHostKeyChecking no
|
|
37
|
+
PasswordAuthentication no
|
|
38
|
+
IdentityFile /home
|
|
39
|
+
IdentitiesOnly yes
|
|
40
|
+
LogLevel FATAL
|
|
41
|
+
EOT
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let(:vagrant_ssh_config_output_two) {
|
|
45
|
+
unindent(<<-EOT)
|
|
46
|
+
Host two
|
|
47
|
+
HostName 192.168.122.2
|
|
48
|
+
User vagrant
|
|
49
|
+
Port 22
|
|
50
|
+
UserKnownHostsFile /dev/null
|
|
51
|
+
StrictHostKeyChecking no
|
|
52
|
+
PasswordAuthentication no
|
|
53
|
+
IdentityFile /home
|
|
54
|
+
IdentitiesOnly yes
|
|
55
|
+
LogLevel FATAL
|
|
56
|
+
EOT
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let(:vagrant_ssh_config_output_three) {
|
|
60
|
+
unindent(<<-EOT)
|
|
61
|
+
Host three
|
|
62
|
+
HostName 192.168.122.3
|
|
63
|
+
User vagrant
|
|
64
|
+
Port 22
|
|
65
|
+
UserKnownHostsFile /dev/null
|
|
66
|
+
StrictHostKeyChecking no
|
|
67
|
+
PasswordAuthentication no
|
|
68
|
+
IdentityFile /home
|
|
69
|
+
IdentitiesOnly yes
|
|
70
|
+
LogLevel FATAL
|
|
71
|
+
EOT
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let(:vagrant_ssh_config_output_all) {
|
|
75
|
+
[
|
|
76
|
+
vagrant_ssh_config_output_one,
|
|
77
|
+
vagrant_ssh_config_output_two,
|
|
78
|
+
vagrant_ssh_config_output_three
|
|
79
|
+
].join("")
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let(:vagrant_ssh_config_output_empty_line) {
|
|
83
|
+
unindent(<<-EOT)
|
|
84
|
+
Host empty-line
|
|
85
|
+
|
|
86
|
+
HostName 192.168.122.1
|
|
87
|
+
EOT
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
let(:vagrant_ssh_config_output_comment) {
|
|
91
|
+
unindent(<<-EOT)
|
|
92
|
+
Host comment
|
|
93
|
+
# comment
|
|
94
|
+
HostName 192.168.122.1
|
|
95
|
+
EOT
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let(:vagrant_ssh_config_output_formatting) {
|
|
99
|
+
unindent(<<-EOT)
|
|
100
|
+
Host formatting
|
|
101
|
+
A a
|
|
102
|
+
B b
|
|
103
|
+
C c
|
|
104
|
+
D d
|
|
105
|
+
E=e
|
|
106
|
+
F =f
|
|
107
|
+
G =g
|
|
108
|
+
H= h
|
|
109
|
+
I= i
|
|
110
|
+
EOT
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let(:vagrant_ssh_config_output_invalid_line) {
|
|
114
|
+
unindent(<<-EOT)
|
|
115
|
+
invalid
|
|
116
|
+
EOT
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let(:vagrant_ssh_config_output_missing_host) {
|
|
120
|
+
unindent(<<-EOT)
|
|
121
|
+
HostName 192.168.122.1
|
|
122
|
+
EOT
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
let(:vagrant_status_output) {
|
|
126
|
+
unindent(<<-EOT)
|
|
127
|
+
Current machine states:
|
|
128
|
+
|
|
129
|
+
\none running (libvirt)
|
|
130
|
+
\ntwo running (libvirt)
|
|
131
|
+
\nthree running (libvirt)
|
|
132
|
+
|
|
133
|
+
This environment represents multiple VMs. The VMs are all listed
|
|
134
|
+
above with their current state. For more information about a specific
|
|
135
|
+
VM, run `vagrant status NAME`.
|
|
136
|
+
EOT
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let(:ssh_config_one) {
|
|
140
|
+
{
|
|
141
|
+
"one" => {
|
|
142
|
+
"HostName" => "192.168.122.1",
|
|
143
|
+
"User" => "vagrant",
|
|
144
|
+
"Port" => "22",
|
|
145
|
+
"UserKnownHostsFile" => "/dev/null",
|
|
146
|
+
"StrictHostKeyChecking" => "no",
|
|
147
|
+
"PasswordAuthentication" => "no",
|
|
148
|
+
"IdentityFile" => "/home",
|
|
149
|
+
"IdentitiesOnly" => "yes",
|
|
150
|
+
"LogLevel" => "FATAL"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
let(:ssh_config_two) {
|
|
156
|
+
{
|
|
157
|
+
"two" => {
|
|
158
|
+
"HostName" => "192.168.122.2",
|
|
159
|
+
"User" => "vagrant",
|
|
160
|
+
"Port" => "22",
|
|
161
|
+
"UserKnownHostsFile" => "/dev/null",
|
|
162
|
+
"StrictHostKeyChecking" => "no",
|
|
163
|
+
"PasswordAuthentication" => "no",
|
|
164
|
+
"IdentityFile" => "/home",
|
|
165
|
+
"IdentitiesOnly" => "yes",
|
|
166
|
+
"LogLevel" => "FATAL"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
let(:ssh_config_three) {
|
|
172
|
+
{
|
|
173
|
+
"three" => {
|
|
174
|
+
"HostName" => "192.168.122.3",
|
|
175
|
+
"User" => "vagrant",
|
|
176
|
+
"Port" => "22",
|
|
177
|
+
"UserKnownHostsFile" => "/dev/null",
|
|
178
|
+
"StrictHostKeyChecking" => "no",
|
|
179
|
+
"PasswordAuthentication" => "no",
|
|
180
|
+
"IdentityFile" => "/home",
|
|
181
|
+
"IdentitiesOnly" => "yes",
|
|
182
|
+
"LogLevel" => "FATAL"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
let(:ssh_config_all) {
|
|
188
|
+
ssh_config_one.merge(ssh_config_two).merge(ssh_config_three)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
let(:ssh_config_empty_line) {
|
|
192
|
+
{
|
|
193
|
+
"empty-line" => { "HostName" => "192.168.122.1" }
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
let(:ssh_config_comment) {
|
|
198
|
+
{
|
|
199
|
+
"comment" => { "HostName" => "192.168.122.1" }
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
let(:ssh_config_formatting) {
|
|
204
|
+
{
|
|
205
|
+
"formatting" => {
|
|
206
|
+
"A" => "a",
|
|
207
|
+
"B" => "b",
|
|
208
|
+
"C" => "c",
|
|
209
|
+
"D" => "d",
|
|
210
|
+
"E" => "e",
|
|
211
|
+
"F" => "f",
|
|
212
|
+
"G" => "g",
|
|
213
|
+
"H" => "h",
|
|
214
|
+
"I" => "i"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
it "reads SSH config of one box correctly" do
|
|
220
|
+
expect(Cheetah).to receive(:run).
|
|
221
|
+
with("vagrant", "ssh-config", "one", :stdout => :capture).
|
|
222
|
+
and_return(vagrant_ssh_config_output_one)
|
|
223
|
+
|
|
224
|
+
expect(subject.ssh_config("one")).to eq(ssh_config_one)
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
it "reads SSH config of all boxes correctly" do
|
|
228
|
+
expect(Cheetah).to receive(:run).
|
|
229
|
+
with("vagrant", "status", :stdout => :capture).
|
|
230
|
+
and_return(vagrant_status_output)
|
|
231
|
+
expect(Cheetah).to receive(:run).
|
|
232
|
+
with("vagrant", "ssh-config", "one", :stdout => :capture).
|
|
233
|
+
and_return(vagrant_ssh_config_output_one)
|
|
234
|
+
expect(Cheetah).to receive(:run).
|
|
235
|
+
with("vagrant", "ssh-config", "two", :stdout => :capture).
|
|
236
|
+
and_return(vagrant_ssh_config_output_two)
|
|
237
|
+
expect(Cheetah).to receive(:run).
|
|
238
|
+
with("vagrant", "ssh-config", "three", :stdout => :capture).
|
|
239
|
+
and_return(vagrant_ssh_config_output_three)
|
|
240
|
+
|
|
241
|
+
expect(subject.ssh_config(nil)).to eq(ssh_config_all)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
it "ignores empty lines" do
|
|
245
|
+
expect(Cheetah).to receive(:run).
|
|
246
|
+
with("vagrant", "ssh-config", "empty-line", :stdout => :capture).
|
|
247
|
+
and_return(vagrant_ssh_config_output_empty_line)
|
|
248
|
+
|
|
249
|
+
expect(subject.ssh_config("empty-line")).to eq(ssh_config_empty_line)
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
it "ignores comments" do
|
|
253
|
+
expect(Cheetah).to receive(:run).
|
|
254
|
+
with("vagrant", "ssh-config", "comment", :stdout => :capture).
|
|
255
|
+
and_return(vagrant_ssh_config_output_comment)
|
|
256
|
+
|
|
257
|
+
expect(subject.ssh_config("comment")).to eq(ssh_config_comment)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
it "ignores formatting variations" do
|
|
261
|
+
expect(Cheetah).to receive(:run).
|
|
262
|
+
with("vagrant", "ssh-config", "formatting", :stdout => :capture).
|
|
263
|
+
and_return(vagrant_ssh_config_output_formatting)
|
|
264
|
+
|
|
265
|
+
expect(subject.ssh_config("formatting")).to eq(ssh_config_formatting)
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
it "raises an exception when encountering an invalid line" do
|
|
269
|
+
expect(Cheetah).to receive(:run).
|
|
270
|
+
with("vagrant", "ssh-config", "invalid-line", :stdout => :capture).
|
|
271
|
+
and_return(vagrant_ssh_config_output_invalid_line)
|
|
272
|
+
|
|
273
|
+
expect {
|
|
274
|
+
subject.ssh_config("invalid-line")
|
|
275
|
+
}.to raise_error("Invalid line in SSH config: \"invalid\".")
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
it "raises an exception when the Host keyword is missing" do
|
|
279
|
+
expect(Cheetah).to receive(:run).
|
|
280
|
+
with("vagrant", "ssh-config", "missing-host", :stdout => :capture).
|
|
281
|
+
and_return(vagrant_ssh_config_output_missing_host)
|
|
282
|
+
|
|
283
|
+
expect {
|
|
284
|
+
subject.ssh_config("missing-host")
|
|
285
|
+
}.to raise_error("Missing Host keyword before HostName.")
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
end
|
data/spec/vm_spec.rb
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Copyright (c) 2013-2014 SUSE LLC
|
|
2
|
+
#
|
|
3
|
+
# This program is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of version 3 of the GNU General Public License as
|
|
5
|
+
# published by the Free Software Foundation.
|
|
6
|
+
#
|
|
7
|
+
# This program is distributed in the hope that it will be useful,
|
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10
|
+
# GNU General Public License for more details.
|
|
11
|
+
#
|
|
12
|
+
# You should have received a copy of the GNU General Public License
|
|
13
|
+
# along with this program; if not, contact SUSE LLC.
|
|
14
|
+
#
|
|
15
|
+
# To contact SUSE about this file by physical or electronic mail,
|
|
16
|
+
# you may find current contact information at www.suse.com
|
|
17
|
+
|
|
18
|
+
require "pennyworth/spec"
|
|
19
|
+
|
|
20
|
+
describe Pennyworth::VM do
|
|
21
|
+
let(:command_runner) { double(:run) }
|
|
22
|
+
let(:runner) { double(command_runner: command_runner) }
|
|
23
|
+
subject { Pennyworth::VM.new(runner) }
|
|
24
|
+
|
|
25
|
+
describe "#run_command" do
|
|
26
|
+
it "lets the CommandRunner run the command" do
|
|
27
|
+
expect(command_runner).to receive(:run)
|
|
28
|
+
|
|
29
|
+
subject.run_command("ls")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe "#extract_file" do
|
|
34
|
+
it "lets the CommandRunner extract the file" do
|
|
35
|
+
expect(command_runner).to receive(:extract_file).with("/etc/hosts", "/tmp")
|
|
36
|
+
|
|
37
|
+
subject.extract_file("/etc/hosts", "/tmp")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe "#inject_file" do
|
|
42
|
+
it "lets the CommandRunner inject the file" do
|
|
43
|
+
expect(command_runner).to receive(:inject_file).with("/tmp/hosts", "/etc", {})
|
|
44
|
+
|
|
45
|
+
subject.inject_file("/tmp/hosts", "/etc")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe "#inject_directory" do
|
|
50
|
+
it "lets the CommandRunner inject the file" do
|
|
51
|
+
expect(command_runner).to receive(:inject_directory).with("/tmp/hosts", "/etc", {})
|
|
52
|
+
|
|
53
|
+
subject.inject_directory("/tmp/hosts", "/etc")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: pennyworth-tool
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- SUSE
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: gli
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 2.11.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 2.11.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: cheetah
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: colorize
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: nokogiri
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: ruby-libvirt
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 0.4.0
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 0.4.0
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: ronn
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 0.7.3
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: 0.7.3
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rake
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
description: Pennyworth is a tool for running integration tests inside a network of
|
|
112
|
+
virtual machines. It allows to define virtual machines, build them as Vagrant boxes
|
|
113
|
+
and run them using libvirt and kvm in coordinated fashion in order to run the tests.
|
|
114
|
+
These tests can be written in any language/framework, but the preferred combination
|
|
115
|
+
is Ruby/RSpec, for which helpers are provided.
|
|
116
|
+
email:
|
|
117
|
+
- machinery@lists.suse.com
|
|
118
|
+
executables:
|
|
119
|
+
- pennyworth
|
|
120
|
+
extensions: []
|
|
121
|
+
extra_rdoc_files: []
|
|
122
|
+
files:
|
|
123
|
+
- ".gitignore"
|
|
124
|
+
- ".hound.yml"
|
|
125
|
+
- ".rspec"
|
|
126
|
+
- ".rubocop.yml"
|
|
127
|
+
- CONTRIBUTING.md
|
|
128
|
+
- COPYING
|
|
129
|
+
- Gemfile
|
|
130
|
+
- README.md
|
|
131
|
+
- Rakefile
|
|
132
|
+
- bin/pennyworth
|
|
133
|
+
- config/setup.yml
|
|
134
|
+
- examples/README.md
|
|
135
|
+
- examples/kiwi/definitions/base_opensuse13.1_kvm/config.sh
|
|
136
|
+
- examples/kiwi/definitions/base_opensuse13.1_kvm/config.xml
|
|
137
|
+
- examples/kiwi/definitions/base_opensuse13.1_kvm/root/etc/sysconfig/network/ifcfg-eth0
|
|
138
|
+
- examples/kiwi/definitions/base_opensuse13.1_kvm/root/home/vagrant/.ssh/authorized_keys
|
|
139
|
+
- examples/vagrant/Vagrantfile
|
|
140
|
+
- files/99-libvirt.rules
|
|
141
|
+
- files/image_test-template.xml
|
|
142
|
+
- files/pool-default.xml
|
|
143
|
+
- lib/image_runner.rb
|
|
144
|
+
- lib/pennyworth.rb
|
|
145
|
+
- lib/pennyworth/cli.rb
|
|
146
|
+
- lib/pennyworth/cli_host_controller.rb
|
|
147
|
+
- lib/pennyworth/commands/base_command.rb
|
|
148
|
+
- lib/pennyworth/commands/boot_command.rb
|
|
149
|
+
- lib/pennyworth/commands/build_base_command.rb
|
|
150
|
+
- lib/pennyworth/commands/command.rb
|
|
151
|
+
- lib/pennyworth/commands/down_command.rb
|
|
152
|
+
- lib/pennyworth/commands/import_base_command.rb
|
|
153
|
+
- lib/pennyworth/commands/import_ssh_keys_command.rb
|
|
154
|
+
- lib/pennyworth/commands/list_command.rb
|
|
155
|
+
- lib/pennyworth/commands/setup_command.rb
|
|
156
|
+
- lib/pennyworth/commands/shutdown_command.rb
|
|
157
|
+
- lib/pennyworth/commands/status_command.rb
|
|
158
|
+
- lib/pennyworth/commands/up_command.rb
|
|
159
|
+
- lib/pennyworth/exceptions.rb
|
|
160
|
+
- lib/pennyworth/helper.rb
|
|
161
|
+
- lib/pennyworth/host_config.rb
|
|
162
|
+
- lib/pennyworth/host_runner.rb
|
|
163
|
+
- lib/pennyworth/image_runner.rb
|
|
164
|
+
- lib/pennyworth/libvirt.rb
|
|
165
|
+
- lib/pennyworth/local_command_runner.rb
|
|
166
|
+
- lib/pennyworth/local_runner.rb
|
|
167
|
+
- lib/pennyworth/lock_service.rb
|
|
168
|
+
- lib/pennyworth/remote_command_runner.rb
|
|
169
|
+
- lib/pennyworth/runner.rb
|
|
170
|
+
- lib/pennyworth/settings.rb
|
|
171
|
+
- lib/pennyworth/spec.rb
|
|
172
|
+
- lib/pennyworth/spec_profiler.rb
|
|
173
|
+
- lib/pennyworth/ssh_keys_importer.rb
|
|
174
|
+
- lib/pennyworth/urls.rb
|
|
175
|
+
- lib/pennyworth/vagrant.rb
|
|
176
|
+
- lib/pennyworth/vagrant_command.rb
|
|
177
|
+
- lib/pennyworth/vagrant_runner.rb
|
|
178
|
+
- lib/pennyworth/version.rb
|
|
179
|
+
- lib/pennyworth/vm.rb
|
|
180
|
+
- man/.gitignore
|
|
181
|
+
- man/pennyworth.1.md
|
|
182
|
+
- pennyworth.gemspec
|
|
183
|
+
- prophet/Gemfile
|
|
184
|
+
- prophet/prophet.rb
|
|
185
|
+
- spec/base_command_spec.rb
|
|
186
|
+
- spec/build_base_command_spec.rb
|
|
187
|
+
- spec/cli_host_controller_spec.rb
|
|
188
|
+
- spec/data/hosts.yaml
|
|
189
|
+
- spec/data/kiwi/base_opensuse12.3_kvm.box
|
|
190
|
+
- spec/data/kiwi/base_opensuse13.1_kvm.box
|
|
191
|
+
- spec/data/kiwi/definitions/base_opensuse12.3_kvm/config.sh
|
|
192
|
+
- spec/data/kiwi/definitions/base_opensuse12.3_kvm/config.xml
|
|
193
|
+
- spec/data/kiwi/definitions/base_opensuse12.3_kvm/root/home/vagrant/.ssh/authorized_keys
|
|
194
|
+
- spec/data/kiwi/definitions/base_opensuse13.1_kvm/config.sh
|
|
195
|
+
- spec/data/kiwi/definitions/base_opensuse13.1_kvm/config.xml
|
|
196
|
+
- spec/data/kiwi/definitions/base_opensuse13.1_kvm/root/home/vagrant/.ssh/authorized_keys
|
|
197
|
+
- spec/data/kiwi2/box_state.yaml
|
|
198
|
+
- spec/data/kiwi2/definitions/base_opensuse12.3_kvm/config.sh
|
|
199
|
+
- spec/data/kiwi2/definitions/base_opensuse12.3_kvm/config.xml
|
|
200
|
+
- spec/data/kiwi2/definitions/base_opensuse12.3_kvm/root/home/vagrant/.ssh/authorized_keys
|
|
201
|
+
- spec/data/kiwi2/definitions/base_opensuse13.1_kvm/config.sh
|
|
202
|
+
- spec/data/kiwi2/definitions/base_opensuse13.1_kvm/config.xml
|
|
203
|
+
- spec/data/kiwi2/definitions/base_opensuse13.1_kvm/root/home/vagrant/.ssh/authorized_keys
|
|
204
|
+
- spec/data/kiwi3/box_state.yaml
|
|
205
|
+
- spec/data/kiwi3/definitions/base_opensuse12.3_kvm/.gitkeep
|
|
206
|
+
- spec/data/kiwi3/definitions/base_opensuse13.1_kvm/.gitkeep
|
|
207
|
+
- spec/data/kiwi3/import_state.yaml
|
|
208
|
+
- spec/data/kiwi4/definitions/base_opensuse12.3_kvm/.gitkeep
|
|
209
|
+
- spec/data/kiwi4/definitions/base_opensuse13.1_kvm/.gitkeep
|
|
210
|
+
- spec/data/kiwi4/import_state.yaml
|
|
211
|
+
- spec/data/kiwi5/import_state.yaml
|
|
212
|
+
- spec/data/vagrant/.gitkeep
|
|
213
|
+
- spec/host_config_spec.rb
|
|
214
|
+
- spec/host_runner_spec.rb
|
|
215
|
+
- spec/image_runner_spec.rb
|
|
216
|
+
- spec/import_base_command_spec.rb
|
|
217
|
+
- spec/local_command_runner_spec.rb
|
|
218
|
+
- spec/local_runner_spec.rb
|
|
219
|
+
- spec/lock_service_spec.rb
|
|
220
|
+
- spec/remote_command_runner_spec.rb
|
|
221
|
+
- spec/settings_spec.rb
|
|
222
|
+
- spec/setup_command_spec.rb
|
|
223
|
+
- spec/spec_helper.rb
|
|
224
|
+
- spec/spec_profiler_spec.rb
|
|
225
|
+
- spec/spec_spec.rb
|
|
226
|
+
- spec/support/command_runner_examples.rb
|
|
227
|
+
- spec/support/runner_examples.rb
|
|
228
|
+
- spec/urls_spec.rb
|
|
229
|
+
- spec/vagrant_command_spec.rb
|
|
230
|
+
- spec/vagrant_runner_spec.rb
|
|
231
|
+
- spec/vagrant_spec.rb
|
|
232
|
+
- spec/vm_spec.rb
|
|
233
|
+
homepage: https://github.com/SUSE/pennyworth
|
|
234
|
+
licenses:
|
|
235
|
+
- GPL-3.0
|
|
236
|
+
metadata: {}
|
|
237
|
+
post_install_message:
|
|
238
|
+
rdoc_options: []
|
|
239
|
+
require_paths:
|
|
240
|
+
- lib
|
|
241
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
|
+
requirements:
|
|
243
|
+
- - ">="
|
|
244
|
+
- !ruby/object:Gem::Version
|
|
245
|
+
version: '0'
|
|
246
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
|
+
requirements:
|
|
248
|
+
- - ">="
|
|
249
|
+
- !ruby/object:Gem::Version
|
|
250
|
+
version: 1.3.6
|
|
251
|
+
requirements: []
|
|
252
|
+
rubyforge_project: pennyworth
|
|
253
|
+
rubygems_version: 2.2.2
|
|
254
|
+
signing_key:
|
|
255
|
+
specification_version: 4
|
|
256
|
+
summary: A tool for running integration tests inside a network of virtual machines
|
|
257
|
+
test_files: []
|