vagrant-ovirt4 1.0.0

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.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +18 -0
  5. data/Gemfile.lock +54 -0
  6. data/README.md +110 -0
  7. data/Rakefile +22 -0
  8. data/example_box/README.md +13 -0
  9. data/example_box/Vagrantfile +14 -0
  10. data/example_box/metadata.json +4 -0
  11. data/lib/vagrant-ovirt4/action/connect_ovirt.rb +38 -0
  12. data/lib/vagrant-ovirt4/action/create_network_interfaces.rb +58 -0
  13. data/lib/vagrant-ovirt4/action/create_vm.rb +92 -0
  14. data/lib/vagrant-ovirt4/action/destroy_vm.rb +25 -0
  15. data/lib/vagrant-ovirt4/action/halt_vm.rb +23 -0
  16. data/lib/vagrant-ovirt4/action/is_created.rb +19 -0
  17. data/lib/vagrant-ovirt4/action/is_running.rb +19 -0
  18. data/lib/vagrant-ovirt4/action/message_already_up.rb +16 -0
  19. data/lib/vagrant-ovirt4/action/message_not_created.rb +16 -0
  20. data/lib/vagrant-ovirt4/action/message_not_suspended.rb +16 -0
  21. data/lib/vagrant-ovirt4/action/message_not_up.rb +16 -0
  22. data/lib/vagrant-ovirt4/action/message_powering_up.rb +16 -0
  23. data/lib/vagrant-ovirt4/action/message_saving_state.rb +16 -0
  24. data/lib/vagrant-ovirt4/action/read_ssh_info.rb +56 -0
  25. data/lib/vagrant-ovirt4/action/read_state.rb +47 -0
  26. data/lib/vagrant-ovirt4/action/set_name_of_domain.rb +24 -0
  27. data/lib/vagrant-ovirt4/action/snapshot_delete.rb +37 -0
  28. data/lib/vagrant-ovirt4/action/snapshot_list.rb +58 -0
  29. data/lib/vagrant-ovirt4/action/snapshot_save.rb +28 -0
  30. data/lib/vagrant-ovirt4/action/start_vm.rb +80 -0
  31. data/lib/vagrant-ovirt4/action/suspend_vm.rb +24 -0
  32. data/lib/vagrant-ovirt4/action/sync_folders.rb +69 -0
  33. data/lib/vagrant-ovirt4/action/wait_til_suspended.rb +44 -0
  34. data/lib/vagrant-ovirt4/action/wait_till_down.rb +47 -0
  35. data/lib/vagrant-ovirt4/action/wait_till_up.rb +83 -0
  36. data/lib/vagrant-ovirt4/action.rb +255 -0
  37. data/lib/vagrant-ovirt4/cap/snapshot_list.rb +12 -0
  38. data/lib/vagrant-ovirt4/cap/snapshot_save.rb +12 -0
  39. data/lib/vagrant-ovirt4/config.rb +49 -0
  40. data/lib/vagrant-ovirt4/errors.rb +48 -0
  41. data/lib/vagrant-ovirt4/plugin.rb +80 -0
  42. data/lib/vagrant-ovirt4/provider.rb +76 -0
  43. data/lib/vagrant-ovirt4/util/collection.rb +21 -0
  44. data/lib/vagrant-ovirt4/util/timer.rb +17 -0
  45. data/lib/vagrant-ovirt4/util.rb +9 -0
  46. data/lib/vagrant-ovirt4/version.rb +6 -0
  47. data/lib/vagrant-ovirt4.rb +38 -0
  48. data/locales/en.yml +74 -0
  49. data/spec/spec_helper.rb +1 -0
  50. data/spec/vagrant-ovirt4/action/is_created_spec.rb +40 -0
  51. data/spec/vagrant-ovirt4/action/is_running_spec.rb +40 -0
  52. data/spec/vagrant-ovirt4/action/message_already_up_spec.rb +20 -0
  53. data/spec/vagrant-ovirt4/action/message_not_created_spec.rb +20 -0
  54. data/spec/vagrant-ovirt4/action/message_not_suspended_spec.rb +20 -0
  55. data/spec/vagrant-ovirt4/action/message_not_up_spec.rb +20 -0
  56. data/spec/vagrant-ovirt4/action/message_powering_up_spec.rb +20 -0
  57. data/spec/vagrant-ovirt4/action/message_saving_state_spec.rb +20 -0
  58. data/spec/vagrant-ovirt4/action/read_ssh_info_spec.rb +73 -0
  59. data/spec/vagrant-ovirt4/action/read_state_spec.rb +68 -0
  60. data/spec/vagrant-ovirt4/config_spec.rb +55 -0
  61. data/tools/prepare_redhat_for_box.sh +113 -0
  62. data/vagrant-ovirt4.gemspec +26 -0
  63. metadata +180 -0
data/locales/en.yml ADDED
@@ -0,0 +1,74 @@
1
+ en:
2
+ vagrant_ovirt4:
3
+ creating_vm: |-
4
+ Creating VM with the following settings...
5
+ starting_vm: |-
6
+ Starting VM.
7
+ not_created: |-
8
+ VM is not created. Please run `vagrant up` first.
9
+ already_up: |-
10
+ VM is already up.
11
+ not_up: |-
12
+ VM is not running. Please run `vagrant up` first.
13
+ powering_up: |-
14
+ VM is currently powering up. Please run `vagrant halt` to abort or wait until its status is 'up'.
15
+ wait_for_ready_vm: |-
16
+ Waiting for VM to become "ready" to start...
17
+ error_recovering: |-
18
+ An error occured. Recovering..
19
+ waiting_for_ip: |-
20
+ Waiting for VM to get an IP address...
21
+ rsync_folder: |-
22
+ Rsyncing folder: %{hostpath} => %{guestpath}
23
+ ready: |-
24
+ Machine is booted and ready for use!
25
+ halt_vm: |-
26
+ Halting VM...
27
+ wait_till_down: |-
28
+ Waiting for VM to shutdown...
29
+ wait_til_suspended: |-
30
+ Waiting for VM to suspend...
31
+ destroy_vm: |-
32
+ Removing VM...
33
+ already_up: |-
34
+ VM is already up.
35
+ suspend_vm: |-
36
+ Suspending VM...
37
+ not_suspended: |-
38
+ VM is not in a suspended state.
39
+ saving_state: |-
40
+ VM is busy saving state. Please wait and try again.
41
+ snapshot_list: |-
42
+ Retrieving list of snapshots...
43
+ snapshot_save: |-
44
+ Creating snapshot...
45
+ snapshot_delete: |-
46
+ Deleting snapshot...
47
+ states:
48
+ long_up: |-
49
+ The instance is running. Use `vagrant halt` to stop it.
50
+ short_up: |-
51
+ up
52
+ long_down: |-
53
+ The instance is not running. Use `vagrant up` to start it.
54
+ short_down: |-
55
+ down
56
+ errors:
57
+ no_vm_error: |-
58
+ No VM %{vm_name} found.
59
+ create_vm_error: |-
60
+ %{error_message}
61
+ start_vm_error: |-
62
+ Unable to start VM: %{error_message}
63
+ no_network_error: |-
64
+ No network %{network_name} found.
65
+ wait_for_ready_vm_timeout: |-
66
+ Timeout occurred while waiting for VM to become ready to start
67
+ add_interface_error: |-
68
+ Error while adding new interface to VM. %{error_message}
69
+ no_ip_error: |-
70
+ The VM has not reported an IP address. Please ensure the ovirt-guest-agent is running and the machine is up.
71
+ remove_active_snapshot_error: |-
72
+ Snapshot with id %{id} is the active snapshot which cannot be removed.
73
+ remove_snapshot_error: |-
74
+ Snapshot with id %{id} Could not be removed. Details: %{error_message}.
@@ -0,0 +1 @@
1
+ require 'vagrant'
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+ require "vagrant-ovirt4/action/is_created"
3
+
4
+ describe VagrantPlugins::OVirtProvider::Action::IsCreated do
5
+ let(:app) { lambda { |env| } }
6
+ let(:env) {
7
+ OpenStruct.new({
8
+ vms_service: {},
9
+ machine: OpenStruct.new({}),
10
+ })
11
+ }
12
+
13
+ subject(:action) { described_class.new(app, env) }
14
+
15
+ context 'is created' do
16
+ before do
17
+ allow(env.machine).to receive(:state).and_return({})
18
+ allow(env.machine.state).to receive(:id).and_return('444')
19
+ end
20
+
21
+ it 'calls is created' do
22
+ action.call(env)
23
+ expect(env.result).to eq(true)
24
+ end
25
+ end
26
+
27
+ context 'is not created' do
28
+ before do
29
+ allow(env.machine).to receive(:state).and_return({})
30
+ allow(env.machine.state).to receive(:id).and_return(:not_created)
31
+ end
32
+
33
+ it 'calls is created' do
34
+ action.call(env)
35
+ expect(env.result).to eq(false)
36
+ end
37
+
38
+ end
39
+
40
+ end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+ require "vagrant-ovirt4/action/is_running"
3
+
4
+ describe VagrantPlugins::OVirtProvider::Action::IsRunning do
5
+ let(:app) { lambda { |env| } }
6
+ let(:env) {
7
+ OpenStruct.new({
8
+ vms_service: {},
9
+ machine: OpenStruct.new({}),
10
+ })
11
+ }
12
+
13
+ subject(:action) { described_class.new(app, env) }
14
+
15
+ context 'is running' do
16
+ before do
17
+ allow(env.machine).to receive(:state).and_return({})
18
+ allow(env.machine.state).to receive(:id).and_return(:up)
19
+ end
20
+
21
+ it 'calls is running' do
22
+ action.call(env)
23
+ expect(env.result).to eq(true)
24
+ end
25
+ end
26
+
27
+ context 'is not running' do
28
+ before do
29
+ allow(env.machine).to receive(:state).and_return({})
30
+ allow(env.machine.state).to receive(:id).and_return(:down)
31
+ end
32
+
33
+ it 'calls is running' do
34
+ action.call(env)
35
+ expect(env.result).to eq(false)
36
+ end
37
+
38
+ end
39
+
40
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require "vagrant-ovirt4/action/message_already_up"
3
+
4
+ describe VagrantPlugins::OVirtProvider::Action::MessageAlreadyUp do
5
+ let(:app) { lambda { |env| } }
6
+ let(:env) {
7
+ OpenStruct.new({
8
+ vms_service: {},
9
+ machine: OpenStruct.new({}),
10
+ })
11
+ }
12
+
13
+
14
+ subject(:action) { described_class.new(app, env) }
15
+
16
+ it 'calls message already up' do
17
+ expect(action).to receive(:call).with(env)
18
+ action.call(env)
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require "vagrant-ovirt4/action/message_not_created"
3
+
4
+ describe VagrantPlugins::OVirtProvider::Action::MessageNotCreated do
5
+ let(:app) { lambda { |env| } }
6
+ let(:env) {
7
+ OpenStruct.new({
8
+ vms_service: {},
9
+ machine: OpenStruct.new({}),
10
+ })
11
+ }
12
+
13
+
14
+ subject(:action) { described_class.new(app, env) }
15
+
16
+ it 'calls message not created' do
17
+ expect(action).to receive(:call).with(env)
18
+ action.call(env)
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require "vagrant-ovirt4/action/message_not_suspended"
3
+
4
+ describe VagrantPlugins::OVirtProvider::Action::MessageNotSuspended do
5
+ let(:app) { lambda { |env| } }
6
+ let(:env) {
7
+ OpenStruct.new({
8
+ vms_service: {},
9
+ machine: OpenStruct.new({}),
10
+ })
11
+ }
12
+
13
+
14
+ subject(:action) { described_class.new(app, env) }
15
+
16
+ it 'calls message not up' do
17
+ expect(action).to receive(:call).with(env)
18
+ action.call(env)
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require "vagrant-ovirt4/action/message_not_up"
3
+
4
+ describe VagrantPlugins::OVirtProvider::Action::MessageNotUp do
5
+ let(:app) { lambda { |env| } }
6
+ let(:env) {
7
+ OpenStruct.new({
8
+ vms_service: {},
9
+ machine: OpenStruct.new({}),
10
+ })
11
+ }
12
+
13
+
14
+ subject(:action) { described_class.new(app, env) }
15
+
16
+ it 'calls message not up' do
17
+ expect(action).to receive(:call).with(env)
18
+ action.call(env)
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require "vagrant-ovirt4/action/message_powering_up"
3
+
4
+ describe VagrantPlugins::OVirtProvider::Action::MessagePoweringUp do
5
+ let(:app) { lambda { |env| } }
6
+ let(:env) {
7
+ OpenStruct.new({
8
+ vms_service: {},
9
+ machine: OpenStruct.new({}),
10
+ })
11
+ }
12
+
13
+
14
+ subject(:action) { described_class.new(app, env) }
15
+
16
+ it 'calls message powering up' do
17
+ expect(action).to receive(:call).with(env)
18
+ action.call(env)
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require "vagrant-ovirt4/action/message_saving_state"
3
+
4
+ describe VagrantPlugins::OVirtProvider::Action::MessageNotUp do
5
+ let(:app) { lambda { |env| } }
6
+ let(:env) {
7
+ OpenStruct.new({
8
+ vms_service: {},
9
+ machine: OpenStruct.new({}),
10
+ })
11
+ }
12
+
13
+
14
+ subject(:action) { described_class.new(app, env) }
15
+
16
+ it 'calls message not up' do
17
+ expect(action).to receive(:call).with(env)
18
+ action.call(env)
19
+ end
20
+ end
@@ -0,0 +1,73 @@
1
+ require 'spec_helper'
2
+ require "vagrant-ovirt4/action/read_ssh_info"
3
+
4
+ describe VagrantPlugins::OVirtProvider::Action::ReadSSHInfo do
5
+ let(:app) { lambda { |env| } }
6
+ let(:env) {
7
+ OpenStruct.new({
8
+ vms_service: {},
9
+ machine: OpenStruct.new({}),
10
+ })
11
+ }
12
+
13
+ subject(:action) { described_class.new(app, env) }
14
+
15
+
16
+ it 'calls read ssh info' do
17
+ expect(action).to receive(:call).with(env)
18
+ action.call(env)
19
+ end
20
+
21
+ context 'unknown API error' do
22
+ before do
23
+ allow(env.machine).to receive(:id).and_return('wat')
24
+ allow(env.vms_service).to receive(:vm_service).and_return({})
25
+ allow(env.vms_service.vm_service).to receive(:get).and_raise('boom')
26
+
27
+ end
28
+
29
+ it 'continues the middleware chain' do
30
+ expect(app).to receive(:call).with(env)
31
+ action.call(env)
32
+ expect(env.machine_ssh_info).to eq(:not_created)
33
+ end
34
+
35
+ end
36
+
37
+ context 'machine does not exist' do
38
+ before do
39
+ allow(env.machine).to receive(:id).and_return(nil)
40
+ end
41
+
42
+ it 'continues the middleware chain' do
43
+ expect(app).to receive(:call).with(env)
44
+ action.call(env)
45
+ expect(env.machine_ssh_info).to eq(:not_created)
46
+ end
47
+
48
+ end
49
+
50
+ context 'machine exists' do
51
+ before do
52
+ allow(env.machine).to receive(:id).and_return('wat')
53
+ allow(env.machine).to receive(:config).and_return(OpenStruct.new({
54
+ ssh: OpenStruct.new({
55
+ guest_port: 44,
56
+ }),
57
+ }))
58
+ allow(env.vms_service).to receive(:vm_service).and_return({})
59
+ allow(env.vms_service.vm_service).to receive(:get).and_return({})
60
+ allow(env.vms_service.vm_service).to receive(:nics_service).and_return({})
61
+ allow(env.vms_service.vm_service.nics_service).to receive(:list).and_return({})
62
+ allow(env.vms_service.vm_service.get).to receive(:status).and_return('active')
63
+ end
64
+
65
+ it 'continues the middleware chain' do
66
+ expect(app).to receive(:call).with(env)
67
+ action.call(env)
68
+ expect(env.machine_ssh_info).to eq({:host=>nil, :port=>44, :username=>nil, :private_key_path=>nil, :forward_agent=>nil, :forward_x11=>nil})
69
+ end
70
+
71
+ end
72
+ end
73
+
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+ require "vagrant-ovirt4/action/read_state"
3
+
4
+ describe VagrantPlugins::OVirtProvider::Action::ReadState do
5
+ let(:app) { lambda { |env| } }
6
+ let(:env) {
7
+ OpenStruct.new({
8
+ vms_service: {},
9
+ machine: OpenStruct.new({}),
10
+ })
11
+ }
12
+
13
+ subject(:action) { described_class.new(app, env) }
14
+
15
+
16
+ it 'calls read state' do
17
+ expect(action).to receive(:call).with(env)
18
+ action.call(env)
19
+ end
20
+
21
+ context 'unknown API error' do
22
+ before do
23
+ allow(env.machine).to receive(:id).and_return('wat')
24
+ allow(env.vms_service).to receive(:vm_service).and_return({})
25
+ allow(env.vms_service.vm_service).to receive(:get).and_raise('boom')
26
+
27
+ end
28
+
29
+ it 'continues the middleware chain' do
30
+ expect(app).to receive(:call).with(env)
31
+ action.call(env)
32
+ expect(env.machine_state_id).to eq(:not_created)
33
+ end
34
+
35
+ end
36
+
37
+ context 'machine does not exist' do
38
+ before do
39
+ allow(env.machine).to receive(:id).and_return(nil)
40
+ end
41
+
42
+ it 'continues the middleware chain' do
43
+ expect(app).to receive(:call).with(env)
44
+ action.call(env)
45
+ expect(env.machine_state_id).to eq(:not_created)
46
+ end
47
+
48
+ end
49
+
50
+ context 'machine exists' do
51
+ before do
52
+ allow(env.machine).to receive(:id).and_return('wat')
53
+ allow(env.vms_service).to receive(:vm_service).and_return({})
54
+ allow(env.vms_service.vm_service).to receive(:get).and_return({})
55
+ allow(env.vms_service.vm_service).to receive(:nics_service).and_return([])
56
+ allow(env.vms_service.vm_service.get).to receive(:status).and_return('active')
57
+ allow(env.vms_service.vm_service.nics_service).to receive(:list).and_return([])
58
+ end
59
+
60
+ it 'continues the middleware chain' do
61
+ expect(app).to receive(:call).with(env)
62
+ action.call(env)
63
+ expect(env.machine_state_id).to eq(:active)
64
+ end
65
+
66
+ end
67
+ end
68
+
@@ -0,0 +1,55 @@
1
+ require "vagrant-ovirt4/config"
2
+ require 'rspec/its'
3
+
4
+ # remove deprecation warnings
5
+ # (until someone decides to update the whole spec file to rspec 3.4)
6
+ RSpec.configure do |config|
7
+ # ...
8
+ config.mock_with :rspec do |c|
9
+ c.syntax = [:should, :expect]
10
+ end
11
+ config.expect_with :rspec do |c|
12
+ c.syntax = [:should, :expect]
13
+ end
14
+ end
15
+
16
+ describe VagrantPlugins::OVirtProvider::Config do
17
+ let(:instance) { described_class.new }
18
+
19
+ # Ensure tests are not affected by AWS credential environment variables
20
+ before :each do
21
+ ENV.stub(:[] => nil)
22
+ end
23
+
24
+ describe "defaults" do
25
+ subject do
26
+ instance.tap do |o|
27
+ o.finalize!
28
+ end
29
+ end
30
+
31
+ its("url") { should be_nil }
32
+ its("username") { should be_nil }
33
+ its("password") { should be_nil }
34
+ its("insecure") { should == false }
35
+ its("debug") { should == false }
36
+ its("cpus") { should == 1 }
37
+ its("cluster") { should be_nil }
38
+ its("console") { should be_nil }
39
+ its("template") { should be_nil }
40
+ its("memory") { should == 256 }
41
+
42
+ end
43
+
44
+ describe "overriding defaults" do
45
+ [:url, :username, :password, :insecure, :debug, :cpus, :cluster, :console, :template, :memory].each do |attribute|
46
+
47
+ it "should not default #{attribute} if overridden" do
48
+ instance.send("#{attribute}=".to_sym, "foo")
49
+ instance.finalize!
50
+ instance.send(attribute).should == "foo"
51
+ end
52
+ end
53
+ end
54
+
55
+ end
@@ -0,0 +1,113 @@
1
+ #!/bin/bash +x
2
+
3
+ # This script should help to prepare RedHat and RedHat like OS (CentOS,
4
+ # Scientific Linux, ...) for Vagrant usage.
5
+
6
+ # To create new box image, just install minimal base system in VM. Then upload
7
+ # this script to the VM and run it. After script has finished, halt the machine
8
+ # and then create an oVirt template, which will be used for creating new
9
+ # vagrant machines.
10
+
11
+
12
+ # We need a hostname.
13
+ if [ $# -ne 1 ]; then
14
+ echo "Usage: $0 <hostname>"
15
+ echo "Hostname should be in format vagrant-[os-name], e.g. vagrant-redhat63."
16
+ exit 1
17
+ fi
18
+
19
+
20
+ # On which version of RedHet are we running?
21
+ RHEL_MAJOR_VERSION=$(sed 's/.*release \([0-9]\)\..*/\1/' /etc/redhat-release)
22
+ if [ $? -ne 0 ]; then
23
+ echo "Is this a RedHat distro?"
24
+ exit 1
25
+ fi
26
+ echo "* Found RedHat ${RHEL_MAJOR_VERSION} version."
27
+
28
+ ATOMIC=false
29
+ which yum >/dev/null 2>&1
30
+ [[ $? -eq 0 ]] && ATOMIC=true
31
+
32
+ # Setup hostname vagrant-something.
33
+ FQDN="$1.vagrantup.com"
34
+ if grep '^HOSTNAME=' /etc/sysconfig/network > /dev/null; then
35
+ sed -i 's/HOSTNAME=\(.*\)/HOSTNAME='${FQDN}'/' /etc/sysconfig/network
36
+ else
37
+ echo "HOSTNAME=${FQDN}" >> /etc/sysconfig/network
38
+ fi
39
+
40
+
41
+ # Enable EPEL and Puppet repositories.
42
+ if [[ $ATOMIC != "true" ]]; then
43
+ if [[ $RHEL_MAJOR_VERSION -eq 5 ]]; then
44
+ yum install -y \
45
+ http://ftp.astral.ro/mirrors/fedora/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm \
46
+ https://yum.puppetlabs.com/puppetlabs-release-el-5.noarch.rpm
47
+ elif [[ $RHEL_MAJOR_VERSION -eq 6 ]]; then
48
+ yum install -y \
49
+ http://ftp.astral.ro/mirrors/fedora/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm \
50
+ https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
51
+ elif [[ $RHEL_MAJOR_VERSION -eq 7 ]]; then
52
+ yum install -y \
53
+ http://ftp.astral.ro/mirrors/fedora/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm \
54
+ https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
55
+ else
56
+ echo "Is this a valid major release?"
57
+ exit 1
58
+ fi
59
+ fi
60
+
61
+ # Install some required software.
62
+ if [[ $ATOMIC != "true" ]]; then
63
+ yum -y install openssh-server openssh-clients sudo curl \
64
+ ruby ruby-devel make gcc rubygems rsync puppet ovirt-guest-agent cloud-init
65
+ fi
66
+
67
+ chkconfig sshd on
68
+
69
+ # Users, groups, passwords and sudoers.
70
+ grep 'vagrant' /etc/passwd > /dev/null
71
+ if [ $? -ne 0 ]; then
72
+ echo '* Creating user vagrant.'
73
+ useradd vagrant
74
+ echo 'vagrant' | passwd --stdin vagrant
75
+ fi
76
+ grep '^admin:' /etc/group > /dev/null || groupadd admin
77
+ usermod -G admin vagrant
78
+
79
+ echo 'Defaults env_keep += "SSH_AUTH_SOCK"' >> /etc/sudoers
80
+ echo '%admin ALL=NOPASSWD: ALL' >> /etc/sudoers
81
+ sed -i 's/Defaults\s*requiretty/Defaults !requiretty/' /etc/sudoers
82
+
83
+ # SSH setup
84
+ # Add Vagrant ssh key for root accout.
85
+ sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config
86
+
87
+ vagrant_home=/home/vagrant
88
+ [ -d $vagrant_home/.ssh ] || mkdir $vagrant_home/.ssh
89
+ chmod 700 $vagrant_home/.ssh
90
+ curl -k -L --silent https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub > $vagrant_home/.ssh/authorized_keys
91
+ chmod 600 $vagrant_home/.ssh/authorized_keys
92
+ chown -R vagrant:vagrant $vagrant_home/.ssh
93
+
94
+
95
+ # Disable firewall and switch SELinux to permissive mode.
96
+ chkconfig iptables off
97
+ chkconfig ip6tables off
98
+ sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/sysconfig/selinux
99
+ [ -f /etc/selinux/config ] && sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
100
+
101
+
102
+ # Don't fix ethX names to hw address.
103
+ rm -f /etc/udev/rules.d/*persistent-net.rules
104
+ rm -f /etc/udev/rules.d/*-net.rules
105
+ rm -fr /var/lib/dhclient/*
106
+
107
+ # Interface eth0 should always get IP address via dhcp.
108
+ echo $'' > /etc/sysconfig/network-scripts/ifcfg-eth0
109
+
110
+ # Do some cleanup..
111
+ rm -f /root/.bash_history
112
+ rm -f /root/authorized_keys
113
+ [[ $ATOMIC != "true" ]] && yum clean all
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/vagrant-ovirt4/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Marcus Young"]
6
+ gem.email = ["myoung34@my.apsu.edu"]
7
+ gem.description = %q{Vagrant provider for oVirt and RHEV v4}
8
+ gem.summary = %q{This vagrant plugin provides the ability to create, control, and destroy virtual machines under oVirt/RHEV}
9
+ gem.homepage = "https://github.com/myoung34/vagrant-ovirt4"
10
+ gem.licenses = ['MIT']
11
+
12
+ gem.files = `git ls-files`.split($\)
13
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
14
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.name = "vagrant-ovirt4"
16
+ gem.require_paths = ["lib"]
17
+ gem.version = VagrantPlugins::OVirtProvider::VERSION
18
+
19
+ gem.add_runtime_dependency 'ovirt-engine-sdk', '~> 4.0', '>= 4.0.6'
20
+
21
+ gem.add_development_dependency 'rake', '~> 0'
22
+
23
+ # rspec 3.4 to mock File
24
+ gem.add_development_dependency "rspec", "~> 3.4"
25
+ gem.add_development_dependency 'rspec-its', '~> 0'
26
+ end