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
data/Gemfile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
source "https://rubygems.org"
|
|
19
|
+
|
|
20
|
+
gemspec
|
|
21
|
+
|
|
22
|
+
group :test do
|
|
23
|
+
gem 'rspec', '~> 3.2.0'
|
|
24
|
+
gem 'webmock'
|
|
25
|
+
gem 'given_filesystem'
|
|
26
|
+
gem 'guard'
|
|
27
|
+
gem 'guard-rspec'
|
|
28
|
+
end
|
data/README.md
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
# Pennyworth
|
|
2
|
+
|
|
3
|
+
[](https://codeclimate.com/github/SUSE/pennyworth)
|
|
4
|
+
|
|
5
|
+
Pennyworth is a tool for running integration tests inside a network of virtual
|
|
6
|
+
machines. It allows the user to define virtual machines, build them as Vagrant
|
|
7
|
+
boxes and run them using libvirt and kvm in a coordinated fashion in order to
|
|
8
|
+
run the tests.
|
|
9
|
+
These tests can be written in any language/framework, but the preferred
|
|
10
|
+
combination is Ruby/RSpec, for which helpers are provided.
|
|
11
|
+
|
|
12
|
+
Pennyworth is a spin-off of the
|
|
13
|
+
[Machinery project](http://machinery-project.org). It is used there to manage
|
|
14
|
+
the environment of the integration tests.
|
|
15
|
+
|
|
16
|
+
## Contents
|
|
17
|
+
|
|
18
|
+
* [Installation](#installation)
|
|
19
|
+
* [Overview](#overview)
|
|
20
|
+
- [Defining and Building Machines](#defining-and-building-machines)
|
|
21
|
+
- [Running Boxes](#running-boxes)
|
|
22
|
+
* [Usage](#usage)
|
|
23
|
+
- [Command Line](#command-line)
|
|
24
|
+
- [RSpec Helper](#rspec-helper)
|
|
25
|
+
* [Terminology](#terminology)
|
|
26
|
+
* [Further Information](#further-information)
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
Pennyworth is tested on [openSUSE 13.2](https://en.opensuse.org/Portal:13.2)
|
|
31
|
+
and [SUSE Linux Enterprise Server 12](https://www.suse.com/products/server/).
|
|
32
|
+
It may not work with other openSUSE versions, Linux distributions, or
|
|
33
|
+
operating systems.
|
|
34
|
+
|
|
35
|
+
The following steps will make Pennyworth run on a vanilla openSUSE 13.2 system.
|
|
36
|
+
|
|
37
|
+
1. **Install required packages**
|
|
38
|
+
|
|
39
|
+
Install Git:
|
|
40
|
+
|
|
41
|
+
$ sudo zypper in git
|
|
42
|
+
|
|
43
|
+
Install basic Ruby environment:
|
|
44
|
+
|
|
45
|
+
$ sudo zypper in ruby rubygem-bundler
|
|
46
|
+
|
|
47
|
+
After the installation, make sure that your `ruby20` version is at least
|
|
48
|
+
`2.0.0.p247-3.11.1`:
|
|
49
|
+
|
|
50
|
+
$ rpm -q ruby20
|
|
51
|
+
|
|
52
|
+
With lower versions, `bundle install` won't work because of a
|
|
53
|
+
[bug](https://bugzilla.novell.com/show_bug.cgi?id=858100).
|
|
54
|
+
|
|
55
|
+
Install packages needed to detect a base system:
|
|
56
|
+
|
|
57
|
+
$ sudo zypper in lsb-release
|
|
58
|
+
|
|
59
|
+
Install packages needed to compile Gems with native extensions:
|
|
60
|
+
|
|
61
|
+
$ sudo zypper in gcc-c++ make ruby-devel libvirt-devel libxslt-devel libxml2-devel
|
|
62
|
+
|
|
63
|
+
2. **Clone Pennyworth repository and install Gem dependencies required to run
|
|
64
|
+
the setup**
|
|
65
|
+
|
|
66
|
+
$ git clone https://github.com/SUSE/pennyworth.git
|
|
67
|
+
$ cd pennyworth
|
|
68
|
+
$ bundle config build.nokogiri --use-system-libraries
|
|
69
|
+
$ bundle install --without test
|
|
70
|
+
|
|
71
|
+
3. **Run the setup**
|
|
72
|
+
|
|
73
|
+
$ bin/pennyworth setup
|
|
74
|
+
|
|
75
|
+
4. **Install remaining Gem dependencies**
|
|
76
|
+
|
|
77
|
+
$ bundle install --without ""
|
|
78
|
+
|
|
79
|
+
Specifying an empty value with `--without ""` is necessary because this
|
|
80
|
+
option is “remembered”. If absent, Bundler would use its value from the
|
|
81
|
+
last invocation (`test`).
|
|
82
|
+
|
|
83
|
+
5. **Restart your system**
|
|
84
|
+
|
|
85
|
+
This refreshes information about current user's groups and network setup.
|
|
86
|
+
|
|
87
|
+
6. **Done!**
|
|
88
|
+
|
|
89
|
+
You can now start using Pennyworth.
|
|
90
|
+
|
|
91
|
+
## Overview
|
|
92
|
+
|
|
93
|
+
Pennyworth is a command-line tool built around defining virtual machines,
|
|
94
|
+
building them, and running integration tests on them.
|
|
95
|
+
|
|
96
|
+
The usual workflow is:
|
|
97
|
+
|
|
98
|
+
1. Define machines used to run integration tests and build them. The result
|
|
99
|
+
is a [Vagrant](http://www.vagrantup.com/) box.
|
|
100
|
+
|
|
101
|
+
2. Import built boxes into Vagrant.
|
|
102
|
+
|
|
103
|
+
3. Run the boxes as needed and execute your test on them. Ruby users can use a
|
|
104
|
+
RSpec helper to simplify this step.
|
|
105
|
+
|
|
106
|
+
All these tasks are driven by commands described in the [Usage](#usage) section.
|
|
107
|
+
|
|
108
|
+
### Defining and Building Machines
|
|
109
|
+
|
|
110
|
+
To define and build machines, Pennyworth uses
|
|
111
|
+
[Kiwi](https://github.com/openSUSE/kiwi).
|
|
112
|
+
|
|
113
|
+
When a machine is built, the resulting Vagrant box can be uploaded to a web
|
|
114
|
+
server (manually). Pennyworth running on some other machine can then import it
|
|
115
|
+
instead of using a locally-built box, which can save time and ensure everyone
|
|
116
|
+
has exactly the same environment for running tests.
|
|
117
|
+
|
|
118
|
+
### Running Boxes
|
|
119
|
+
|
|
120
|
+
To run the boxes, Pennyworth uses Vagrant. However, instead of the default
|
|
121
|
+
VirtualBox backend it uses KVM driven by libvirt. The theory is that using open
|
|
122
|
+
source and SUSE-supported technology will be more reliable and performant, which
|
|
123
|
+
should outweigh the somewhat complicated setup.
|
|
124
|
+
|
|
125
|
+
## Usage
|
|
126
|
+
|
|
127
|
+
### Command Line
|
|
128
|
+
|
|
129
|
+
Pennyworth is a command-line tool. You can invoke it by using the `bin/pennyworth`
|
|
130
|
+
command. It accepts subcommands (similarly to `git` or `bundle`).
|
|
131
|
+
|
|
132
|
+
For example:
|
|
133
|
+
|
|
134
|
+
- Building an image
|
|
135
|
+
`$pennyworth build_base example_image --definitions-dir=example_dir`
|
|
136
|
+
|
|
137
|
+
- Listing available VMs
|
|
138
|
+
`$pennyworth list --definitions-dir=example_dir`
|
|
139
|
+
|
|
140
|
+
- Starting a VM
|
|
141
|
+
`$pennyworth up my_machine`
|
|
142
|
+
|
|
143
|
+
For more information about the commands, see the Pennyworth man page.
|
|
144
|
+
|
|
145
|
+
### RSpec Helper
|
|
146
|
+
|
|
147
|
+
Pennyworth contains an RSpec helper that helps with running integration tests
|
|
148
|
+
using Pennyworth.
|
|
149
|
+
|
|
150
|
+
To use the helper, first require it:
|
|
151
|
+
|
|
152
|
+
```ruby
|
|
153
|
+
require "pennyworth/spec"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Replace `<pennyworth-dir>` with a directory into which you installed Pennyworth.
|
|
157
|
+
|
|
158
|
+
In your specs, you can now use the `start_system` method to start a VM, e.g.:
|
|
159
|
+
|
|
160
|
+
```ruby
|
|
161
|
+
describe "my pet feature" do
|
|
162
|
+
it "works flawlessly" do
|
|
163
|
+
vm = start_system(box: "box")
|
|
164
|
+
|
|
165
|
+
# ...
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The `start_system` method can either start an existing Vagrant box, a generic
|
|
171
|
+
VM image runnable by libvirt or connect to an already running system. The method
|
|
172
|
+
returns an object, which can be used to access the system for testing.
|
|
173
|
+
|
|
174
|
+
#### Using Vagrant VMs
|
|
175
|
+
|
|
176
|
+
To start a Vagrant VM, pass its name using the `box` option. The name is looked
|
|
177
|
+
up in the `Vagrantfile` in the directory provided with the `config.vagrant_dir`
|
|
178
|
+
option in RSpec.
|
|
179
|
+
|
|
180
|
+
#### Using generic VM images
|
|
181
|
+
|
|
182
|
+
To start a generic VM image, pass its file path using the `image` option. The
|
|
183
|
+
image is ran in KVM and made available for accessing it for tests.
|
|
184
|
+
|
|
185
|
+
#### Using existing hosts
|
|
186
|
+
|
|
187
|
+
For connecting to an existing running system, pass the name of the system with
|
|
188
|
+
the `host` option. The name is looked up in a configuration file, which by
|
|
189
|
+
default is `~/.pennyworth/hosts.yaml`. The system is accessed with the address
|
|
190
|
+
stored in this file, so that the same name can be used in the tests, even when
|
|
191
|
+
the actual system used for tests is changing.
|
|
192
|
+
|
|
193
|
+
To prevent tests running simultaneously on the same machine to interfere with
|
|
194
|
+
each other, there is a locking mechanism, which automatically makes sure that
|
|
195
|
+
only one test is running on a system at the same time. For this to work a lock
|
|
196
|
+
service is required. The address of the lock service is also defined in the
|
|
197
|
+
`hosts.yaml` configuration file. The lock service has to conform to the API
|
|
198
|
+
implemented by [glockd](https://github.com/apokalyptik/glockd) and has to run
|
|
199
|
+
at the address specified in the configuration file.
|
|
200
|
+
|
|
201
|
+
To simplify setup of tests with existing hosts, there are some helper commands
|
|
202
|
+
in the pennyworth command line application. Get an overview by running
|
|
203
|
+
`pennyworth host`.
|
|
204
|
+
|
|
205
|
+
To initially set up the test infrastructure run
|
|
206
|
+
|
|
207
|
+
pennyworth host setup http://ci.example.org/pennyworth/hosts.yaml
|
|
208
|
+
|
|
209
|
+
with a URL corresponding to where you store the configuration of your test
|
|
210
|
+
hosts. This will create a configuration file which includes the configuration
|
|
211
|
+
from `http://ci.example.com/pennyworth/hosts.yaml` as a reference. The
|
|
212
|
+
configuration will dynamically be fetched from the URL when tests are run.
|
|
213
|
+
You can add local configuration to the `~/.pennyworth/hosts.yaml` file. If it
|
|
214
|
+
defines values for keys from the remote file it overwrites the value by the
|
|
215
|
+
local attribute. This setup makes it easy to distribute a common configuration
|
|
216
|
+
between several systems and users, while still allowing users to have their
|
|
217
|
+
local settings.
|
|
218
|
+
|
|
219
|
+
Pennyworth automatically cleans up the hosts after running the tests using
|
|
220
|
+
snapper snapshots. The snapshot which the system is rolled back to is specified
|
|
221
|
+
by the `base_snapshot_id` of the host entries. Before rolling back a new
|
|
222
|
+
snapshot named `pennyworth` is created which can be used for debugging test
|
|
223
|
+
failures.
|
|
224
|
+
|
|
225
|
+
In some cases (e.g. while working on a test) the automatic rollback might not be
|
|
226
|
+
desired. It can easily be disabled temporarily by setting the
|
|
227
|
+
`SKIP_HOST_CLEANUP` environment variable, e.g.
|
|
228
|
+
|
|
229
|
+
SKIP_HOST_CLEANUP=true rspec
|
|
230
|
+
|
|
231
|
+
An example for the configuration file is:
|
|
232
|
+
|
|
233
|
+
```yaml
|
|
234
|
+
---
|
|
235
|
+
lock_server_address: lockserver.example.org:9999
|
|
236
|
+
hosts:
|
|
237
|
+
test_host_1:
|
|
238
|
+
address: host1.example.org
|
|
239
|
+
base_snapshot_id: 2
|
|
240
|
+
test_host_2:
|
|
241
|
+
address: host2.example.org
|
|
242
|
+
base_snapshot_id: 34
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
In order to use a system as a pennyworth host it needs to be prepared like this:
|
|
246
|
+
|
|
247
|
+
1. The root partition needs to be a Btrfs partition
|
|
248
|
+
2. Snapper needs to be installed and configured for `/`:
|
|
249
|
+
|
|
250
|
+
1. Enable snapper for root by running:
|
|
251
|
+
|
|
252
|
+
snapper create-config /
|
|
253
|
+
|
|
254
|
+
2. Remove more than 5 Pennyworth snapshots and disable the timeline for the new config:
|
|
255
|
+
|
|
256
|
+
snapper set-config NUMBER_LIMIT=5 TIMELINE_CREATE=no
|
|
257
|
+
|
|
258
|
+
3. Disable the automatic zypper snapshots by removing the plugin:
|
|
259
|
+
|
|
260
|
+
zypper rm snapper-zypp-plugin
|
|
261
|
+
|
|
262
|
+
For further details: [Snapper Automatic Snapshot Documentation](https://www.suse.com/documentation/sles-12/singlehtml/book_sle_admin/book_sle_admin.html#sec.snapper.setup.customize.auto_snapshots)
|
|
263
|
+
|
|
264
|
+
3. There can't be any subvolumes below `/` besides `.snapshots`
|
|
265
|
+
4. It's usually helpful to exclude `*/.ssh` from the rollback so that SSH
|
|
266
|
+
access is retained
|
|
267
|
+
|
|
268
|
+
echo "*/.ssh" > /etc/snapper/filters/ssh.txt
|
|
269
|
+
|
|
270
|
+
5. There needs to be a snapper snapshot of the defined state which will be
|
|
271
|
+
configured in the `hosts.yaml`:
|
|
272
|
+
|
|
273
|
+
snapper create --description "Initial Snapshot"
|
|
274
|
+
|
|
275
|
+
The according snapshot id can be retrieved using
|
|
276
|
+
|
|
277
|
+
snapper list
|
|
278
|
+
|
|
279
|
+
#### Accessing test systems
|
|
280
|
+
|
|
281
|
+
Boxes, images and systems have the following requirements:
|
|
282
|
+
|
|
283
|
+
* ssh port is configured to be open in the firewall
|
|
284
|
+
* activated sshd service
|
|
285
|
+
* the public ssh key of the user running pennyworth/rspec tests in /root/.ssh.authorized_keys
|
|
286
|
+
|
|
287
|
+
For boxes handled by pennyworth the ssh key is copied into the target when creating the box,
|
|
288
|
+
for images or hosts this has to be done manually by e.g. running
|
|
289
|
+
`ssh-copy-id root@<HOST>`.
|
|
290
|
+
|
|
291
|
+
The `start_system` method returns a `VM` instance, which can be used to interact
|
|
292
|
+
with the running machine (via SSH). It supports the following methods:
|
|
293
|
+
|
|
294
|
+
* `stop`
|
|
295
|
+
|
|
296
|
+
Stops or disconnects the system. This stops running boxes or images and disconnects from
|
|
297
|
+
running systems.
|
|
298
|
+
|
|
299
|
+
* `run_command(command, *args, options = {})`
|
|
300
|
+
`run_command(command_and_args, options = {})`
|
|
301
|
+
|
|
302
|
+
Executes a command on the running machine. The execution is implemented
|
|
303
|
+
using [Cheetah](https://github.com/opensuse/cheetah) and the `run_command`
|
|
304
|
+
method behaves mostly the same as
|
|
305
|
+
[`Cheetah.run`](http://rubydoc.info/github/openSUSE/cheetah/master/Cheetah.run).
|
|
306
|
+
|
|
307
|
+
* `inject_file(source, destination)`
|
|
308
|
+
|
|
309
|
+
Injects a file from the machine running the specs into the VM.
|
|
310
|
+
|
|
311
|
+
* `inject_directory(source, destination, opts = {})`
|
|
312
|
+
|
|
313
|
+
Injects a file from the machine running the specs into the VM. The `:owner`
|
|
314
|
+
and `:group` options can be used to set the owner and the group of injected
|
|
315
|
+
files.
|
|
316
|
+
|
|
317
|
+
* `extract_file(source, destination)`
|
|
318
|
+
|
|
319
|
+
Extracts a file from the VM into the machine running the specs.
|
|
320
|
+
|
|
321
|
+
All machines started by `start_system` are stopped when the RSpec example group
|
|
322
|
+
containing the call is finished.
|
|
323
|
+
|
|
324
|
+
## Terminology
|
|
325
|
+
|
|
326
|
+
(Vagrant) Box
|
|
327
|
+
: Base image used as a package format for Vagrant environments. Provides an
|
|
328
|
+
identical working environment on any platform. For more information please
|
|
329
|
+
visit the [Vagrant documentation](http://docs.vagrantup.com/v2/boxes.html)
|
|
330
|
+
|
|
331
|
+
VM
|
|
332
|
+
: Virtual machine ran in KVM. Pennyworth supports running VMs described in a
|
|
333
|
+
Vagrantfile as well as non vagrant managed ones.
|
|
334
|
+
|
|
335
|
+
## Further information
|
|
336
|
+
|
|
337
|
+
Further information like a [FAQ](https://github.com/SUSE/pennyworth/wiki/Debugging)
|
|
338
|
+
or a [Troubleshooting guide](https://github.com/SUSE/pennyworth/wiki/Troubleshooting)
|
|
339
|
+
can be found in the [Pennyworth Wiki](https://github.com/SUSE/pennyworth/wiki/).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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 "rspec/core/rake_task"
|
|
19
|
+
|
|
20
|
+
RSpec::Core::RakeTask.new
|
|
21
|
+
|
|
22
|
+
namespace :man_pages do
|
|
23
|
+
task :build do
|
|
24
|
+
puts " Building man pages"
|
|
25
|
+
system "ronn man/*.md"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
namespace :gem do
|
|
30
|
+
task :build => ["man_pages:build"] do
|
|
31
|
+
system "gem build pennyworth.gemspec"
|
|
32
|
+
end
|
|
33
|
+
end
|
data/bin/pennyworth
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2013-2014 SUSE LLC
|
|
4
|
+
#
|
|
5
|
+
# This program is free software; you can redistribute it and/or
|
|
6
|
+
# modify it under the terms of version 3 of the GNU General Public License as
|
|
7
|
+
# published by the Free Software Foundation.
|
|
8
|
+
#
|
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
# GNU General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU General Public License
|
|
15
|
+
# along with this program; if not, contact SUSE LLC.
|
|
16
|
+
#
|
|
17
|
+
# To contact SUSE about this file by physical or electronic mail,
|
|
18
|
+
# you may find current contact information at www.suse.com
|
|
19
|
+
|
|
20
|
+
require_relative "../lib/pennyworth"
|
|
21
|
+
|
|
22
|
+
Pennyworth::Cli.settings = Pennyworth::Settings.new
|
|
23
|
+
|
|
24
|
+
begin
|
|
25
|
+
Pennyworth::Cli.run(ARGV)
|
|
26
|
+
end
|
data/config/setup.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
packages:
|
|
2
|
+
local:
|
|
3
|
+
- curl # Needed to download remote packages
|
|
4
|
+
- iptables # Needed by libvirt to configure network
|
|
5
|
+
- dnsmasq # Needed by libvirt to configure network
|
|
6
|
+
- libxml2-devel # Needed by libvirt plugin for Vagrant
|
|
7
|
+
- libxslt-devel # Needed by libvirt plugin for Vagrant
|
|
8
|
+
- libvirt-devel # Needed by libvirt plugin for Vagrant
|
|
9
|
+
- libvirt # Needed to run VMs
|
|
10
|
+
- expect # Needed to automate interactive commands like ssh-copy-id
|
|
11
|
+
"13.1":
|
|
12
|
+
- kvm # Needed to run VMs
|
|
13
|
+
- libvirt-daemon-qemu # Needed to run QEMU in 13.1
|
|
14
|
+
"13.2":
|
|
15
|
+
- qemu-kvm # Needed to run VMs
|
|
16
|
+
remote:
|
|
17
|
+
- https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.rpm
|