vagrant-registration 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vagrant-registration/action/register.rb +43 -6
- data/lib/vagrant-registration/action/unregister.rb +21 -10
- data/lib/vagrant-registration/config.rb +7 -0
- data/lib/vagrant-registration/plugin.rb +34 -26
- data/lib/vagrant-registration/version.rb +1 -1
- data/locales/en.yml +1 -135
- data/plugins/guests/redhat/cap/unregister.rb +1 -14
- data/tests/shell-scripts/test-rhel-eco-ident/Vagrantfile.centos +14 -0
- data/tests/shell-scripts/test-rhel-eco-ident/Vagrantfile.fedora +14 -0
- data/tests/shell-scripts/test-rhel-eco-ident/Vagrantfile.rhel +14 -0
- data/tests/shell-scripts/test-rhel-eco-ident/test-identification.sh +114 -0
- data/vagrant-registration.gemspec +3 -3
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97fa20b1599696327a619635fe9b1b9a512a2d1f
|
4
|
+
data.tar.gz: 46bfe62a920cff799b56e4fcd9584d17d5fc3454
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bb56047885aae33c1036337689583b4c845980bcc458f843d76a0a1d8025766ac81861aa4db0f8004249acaba882275066faf7d054138738f2bff320b38a216
|
7
|
+
data.tar.gz: b77a8c2831a1e9598d7d2af170f6020394d06c195546a30da2d0ededa3c78cb3d55ba4f4c4c14f4d579d33edd65b6b3e696d729788af4e3623222b95f501b3de
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module Registration
|
3
5
|
module Action
|
@@ -6,21 +8,56 @@ module VagrantPlugins
|
|
6
8
|
|
7
9
|
def initialize(app, env)
|
8
10
|
@app = app
|
9
|
-
@
|
10
|
-
@logger = Log4r::Logger.new("vagrant_register::action::register")
|
11
|
+
@logger = Log4r::Logger.new("vagrant_registration::action::register")
|
11
12
|
end
|
12
13
|
|
13
14
|
def call(env)
|
14
15
|
@app.call(env)
|
15
|
-
|
16
|
+
config = env[:machine].config.registration
|
17
|
+
guest = env[:machine].guest
|
16
18
|
@logger.info("Testing for registration_register capability on ")
|
17
19
|
|
18
20
|
if guest.capability?(:register)
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
unless config.skip
|
22
|
+
env[:ui].info("Registering box with vagrant-registration...")
|
23
|
+
|
24
|
+
# Check if credentials are provided, ask user if not
|
25
|
+
unless credentials_provided? config
|
26
|
+
@logger.debug("credentials for registration not provided")
|
27
|
+
|
28
|
+
# Offer to register ATM or skip
|
29
|
+
register_now = env[:ui].ask("Would you like to register the system now (default: yes)? [y|n] ")
|
30
|
+
|
31
|
+
if register_now == 'n'
|
32
|
+
config.skip = true
|
33
|
+
# Accept anything else as default
|
34
|
+
else
|
35
|
+
config.subscriber_username, config.subscriber_password = register_on_screen(env[:ui])
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
result = guest.capability(:register) unless config.skip
|
40
|
+
else
|
41
|
+
@logger.debug("registration skipped due to configuration")
|
42
|
+
end
|
43
|
+
else
|
44
|
+
@logger.debug("registration skipped due to missing guest capability")
|
22
45
|
end
|
23
46
|
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
# Ask user on username/password and return them
|
51
|
+
def register_on_screen(ui)
|
52
|
+
username = ui.ask("Subscriber username: ")
|
53
|
+
password = ui.ask("Subscriber password: ", echo: false)
|
54
|
+
[username, password]
|
55
|
+
end
|
56
|
+
|
57
|
+
# Check if username and password has been provided in Vagrantfile
|
58
|
+
def credentials_provided?(config)
|
59
|
+
config.subscriber_username && config.subscriber_password
|
60
|
+
end
|
24
61
|
end
|
25
62
|
end
|
26
63
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module Registration
|
3
5
|
module Action
|
@@ -6,23 +8,32 @@ module VagrantPlugins
|
|
6
8
|
|
7
9
|
def initialize(app, env)
|
8
10
|
@app = app
|
9
|
-
@
|
10
|
-
@logger = Log4r::Logger.new("vagrant_register::action::unregister")
|
11
|
+
@logger = Log4r::Logger.new("vagrant_registration::action::unregister")
|
11
12
|
end
|
12
13
|
|
13
14
|
def call(env)
|
14
|
-
guest =
|
15
|
-
|
15
|
+
guest = env[:machine].guest
|
16
|
+
|
16
17
|
if guest.capability?(:unregister)
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
if !env[:machine].config.registration.skip
|
19
|
+
env[:ui].info("Unregistering box with vagrant-registration...")
|
20
|
+
@logger.info("registration_unregister capability exists on ")
|
21
|
+
result = guest.capability(:unregister)
|
22
|
+
@logger.info("called registration_unregister capability on ")
|
23
|
+
else
|
24
|
+
@logger.debug("unregistration is skipped due to configuration")
|
25
|
+
end
|
26
|
+
else
|
27
|
+
@logger.debug("unregistration is skipped due to missing guest capability")
|
20
28
|
end
|
21
|
-
|
29
|
+
|
22
30
|
@app.call(env)
|
23
31
|
|
24
|
-
|
25
|
-
|
32
|
+
# Guest might not be available after halting, so log the exception and continue
|
33
|
+
rescue => e
|
34
|
+
@logger.info(e)
|
35
|
+
@logger.debug("guest is not available, ignore unregistration")
|
36
|
+
@app.call(env)
|
26
37
|
end
|
27
38
|
end
|
28
39
|
end
|
@@ -13,14 +13,21 @@ module VagrantPlugins
|
|
13
13
|
# @return [String]
|
14
14
|
attr_accessor :subscriber_password
|
15
15
|
|
16
|
+
# Skip the registration (skip if true)
|
17
|
+
#
|
18
|
+
# @return [Bool]
|
19
|
+
attr_accessor :skip
|
20
|
+
|
16
21
|
def initialize(region_specific=false)
|
17
22
|
@subscriber_username = UNSET_VALUE
|
18
23
|
@subscriber_password = UNSET_VALUE
|
24
|
+
@skip = UNSET_VALUE
|
19
25
|
end
|
20
26
|
|
21
27
|
def finalize!
|
22
28
|
@subscriber_username = nil if @subscriber_username == UNSET_VALUE
|
23
29
|
@subscriber_password = nil if @subscriber_password == UNSET_VALUE
|
30
|
+
@skip = false if @skip == UNSET_VALUE
|
24
31
|
end
|
25
32
|
end
|
26
33
|
end
|
@@ -1,3 +1,9 @@
|
|
1
|
+
begin
|
2
|
+
require 'vagrant'
|
3
|
+
rescue LoadError
|
4
|
+
raise 'The vagrant-registration plugin must be run within Vagrant.'
|
5
|
+
end
|
6
|
+
|
1
7
|
# This is a sanity check to make sure no one is attempting to install
|
2
8
|
# this into an early Vagrant version.
|
3
9
|
if Vagrant::VERSION < "1.2.0"
|
@@ -7,33 +13,17 @@ end
|
|
7
13
|
module VagrantPlugins
|
8
14
|
module Registration
|
9
15
|
class Plugin < Vagrant.plugin("2")
|
10
|
-
def initialize(app, env)
|
11
|
-
@app = app
|
12
|
-
end
|
13
|
-
|
14
16
|
class << self
|
15
|
-
def initialize(app, env)
|
16
|
-
@app = app
|
17
|
-
@logger = Log4r::Logger.new("vagrant_register::plugin")
|
18
|
-
end
|
19
|
-
|
20
17
|
def register(hook)
|
21
|
-
|
18
|
+
setup_logging
|
22
19
|
hook.after(::Vagrant::Action::Builtin::SyncedFolders,
|
23
20
|
VagrantPlugins::Registration::Action.action_register)
|
24
21
|
end
|
25
22
|
|
26
23
|
def unregister(hook)
|
27
|
-
|
24
|
+
setup_logging
|
28
25
|
hook.prepend(VagrantPlugins::Registration::Action.action_unregister)
|
29
26
|
end
|
30
|
-
|
31
|
-
def unregister_on_destroy(hook)
|
32
|
-
@logger.info("in unregister_on_destroy hook")
|
33
|
-
hook.after(::Vagrant::Action::Builtin::ConfigValidate,
|
34
|
-
VagrantPlugins::Registration::Action.action_unregister)
|
35
|
-
end
|
36
|
-
|
37
27
|
end
|
38
28
|
|
39
29
|
name "Registration"
|
@@ -42,24 +32,42 @@ module VagrantPlugins
|
|
42
32
|
support the capability
|
43
33
|
DESC
|
44
34
|
|
45
|
-
@logger = Log4r::Logger.new("vagrant_register::plugin::setup")
|
46
|
-
@logger.info("attempting to register hooks on up")
|
47
35
|
action_hook(:registration_register, :machine_action_up, &method(:register))
|
48
36
|
action_hook(:registration_register, :machine_action_provision, &method(:register))
|
49
|
-
|
50
|
-
@logger.info("attempting to register hooks on halt")
|
51
37
|
action_hook(:registration_unregister, :machine_action_halt, &method(:unregister))
|
52
38
|
action_hook(:registration_unregister, :machine_action_destroy, &method(:unregister))
|
53
39
|
|
54
|
-
@logger.info("attempting to register hooks on destroy")
|
55
|
-
action_hook(:registration_unregister, :machine_action_destroy, &method(:unregister_on_destroy))
|
56
|
-
|
57
40
|
config(:registration) do
|
58
41
|
require_relative 'config'
|
59
42
|
Config
|
60
43
|
end
|
61
44
|
|
45
|
+
# This sets up our log level to be whatever VAGRANT_LOG is
|
46
|
+
# for loggers prepended with 'vagrant_libvirt'
|
47
|
+
def self.setup_logging
|
48
|
+
require 'log4r'
|
49
|
+
level = nil
|
50
|
+
begin
|
51
|
+
level = Log4r.const_get(ENV['VAGRANT_LOG'].upcase)
|
52
|
+
rescue NameError
|
53
|
+
# This means that the logging constant wasn't found,
|
54
|
+
# which is fine. We just keep `level` as `nil`. But
|
55
|
+
# we tell the user.
|
56
|
+
level = nil
|
57
|
+
end
|
58
|
+
# Some constants, such as "true" resolve to booleans, so the
|
59
|
+
# above error checking doesn't catch it. This will check to make
|
60
|
+
# sure that the log level is an integer, as Log4r requires.
|
61
|
+
level = nil if !level.is_a?(Integer)
|
62
|
+
# Set the logging level on all "vagrant" namespaced
|
63
|
+
# logs as long as we have a valid level.
|
64
|
+
if level
|
65
|
+
logger = Log4r::Logger.new('vagrant_registration')
|
66
|
+
logger.outputters = Log4r::Outputter.stderr
|
67
|
+
logger.level = level
|
68
|
+
logger = nil
|
69
|
+
end
|
70
|
+
end
|
62
71
|
end
|
63
72
|
end
|
64
73
|
end
|
65
|
-
|
data/locales/en.yml
CHANGED
@@ -1,136 +1,2 @@
|
|
1
1
|
en:
|
2
|
-
|
3
|
-
already_status: |-
|
4
|
-
The machine is already %{status}.
|
5
|
-
elb:
|
6
|
-
adjusting: |-
|
7
|
-
Adjusting availability zones of ELB %{elb_name}...
|
8
|
-
registering: |-
|
9
|
-
Registering %{instance_id} at ELB %{elb_name}...
|
10
|
-
deregistering: |-
|
11
|
-
Deregistering %{instance_id} from ELB %{elb_name}...
|
12
|
-
ok: |-
|
13
|
-
ok
|
14
|
-
skipped: |-
|
15
|
-
skipped
|
16
|
-
|
17
|
-
launching_instance: |-
|
18
|
-
Launching an instance with the following settings...
|
19
|
-
launch_no_keypair: |-
|
20
|
-
Warning! You didn't specify a keypair to launch your instance with.
|
21
|
-
This can sometimes result in not being able to access your instance.
|
22
|
-
launch_vpc_warning: |-
|
23
|
-
Warning! You're launching this instance into a VPC without an
|
24
|
-
elastic IP. Please verify you're properly connected to a VPN so
|
25
|
-
you can access this machine, otherwise Vagrant will not be able
|
26
|
-
to SSH into it.
|
27
|
-
not_created: |-
|
28
|
-
Instance is not created. Please run `vagrant up` first.
|
29
|
-
ready: |-
|
30
|
-
Machine is booted and ready for use!
|
31
|
-
rsync_not_found_warning: |-
|
32
|
-
Warning! Folder sync disabled because the rsync binary is missing in the %{side}.
|
33
|
-
Make sure rsync is installed and the binary can be found in the PATH.
|
34
|
-
rsync_folder: |-
|
35
|
-
Rsyncing folder: %{hostpath} => %{guestpath}
|
36
|
-
starting: |-
|
37
|
-
Starting the instance...
|
38
|
-
stopping: |-
|
39
|
-
Stopping the instance...
|
40
|
-
terminating: |-
|
41
|
-
Terminating the instance...
|
42
|
-
waiting_for_ready: |-
|
43
|
-
Waiting for instance to become "ready"...
|
44
|
-
waiting_for_ssh: |-
|
45
|
-
Waiting for SSH to become available...
|
46
|
-
warn_networks: |-
|
47
|
-
Warning! The AWS provider doesn't support any of the Vagrant
|
48
|
-
high-level network configurations (`config.vm.network`). They
|
49
|
-
will be silently ignored.
|
50
|
-
warn_ssh_access: |-
|
51
|
-
Warning! Vagrant might not be able to SSH into the instance.
|
52
|
-
Please check your security groups settings.
|
53
|
-
will_not_destroy: |-
|
54
|
-
The instance '%{name}' will not be destroyed, since the confirmation
|
55
|
-
was declined.
|
56
|
-
|
57
|
-
config:
|
58
|
-
access_key_id_required: |-
|
59
|
-
An access key ID must be specified via "access_key_id"
|
60
|
-
ami_required: |-
|
61
|
-
An AMI must be configured via "ami" (region: #{region})
|
62
|
-
private_key_missing: |-
|
63
|
-
The specified private key for AWS could not be found
|
64
|
-
region_required: |-
|
65
|
-
A region must be specified via "region"
|
66
|
-
secret_access_key_required: |-
|
67
|
-
A secret access key is required via "secret_access_key"
|
68
|
-
subnet_id_required_with_public_ip: |-
|
69
|
-
If you assign a public IP address to an instance in a VPC, a subnet must be specifed via "subnet_id"
|
70
|
-
|
71
|
-
errors:
|
72
|
-
fog_error: |-
|
73
|
-
There was an error talking to AWS. The error message is shown
|
74
|
-
below:
|
75
|
-
|
76
|
-
%{message}
|
77
|
-
internal_fog_error: |-
|
78
|
-
There was an error talking to AWS. The error message is shown
|
79
|
-
below:
|
80
|
-
|
81
|
-
Error: %{error}
|
82
|
-
Response: %{response}
|
83
|
-
instance_ready_timeout: |-
|
84
|
-
The instance never became "ready" in AWS. The timeout currently
|
85
|
-
set waiting for the instance to become ready is %{timeout} seconds.
|
86
|
-
Please verify that the machine properly boots. If you need more time
|
87
|
-
set the `instance_ready_timeout` configuration on the AWS provider.
|
88
|
-
rsync_error: |-
|
89
|
-
There was an error when attempting to rsync a shared folder.
|
90
|
-
Please inspect the error message below for more info.
|
91
|
-
|
92
|
-
Host path: %{hostpath}
|
93
|
-
Guest path: %{guestpath}
|
94
|
-
Error: %{stderr}
|
95
|
-
mkdir_error: |-
|
96
|
-
There was an error when attempting to create a shared host folder.
|
97
|
-
Please inspect the error message below for more info.
|
98
|
-
|
99
|
-
Host path: %{hostpath}
|
100
|
-
Error: %{err}
|
101
|
-
elb_does_not_exist: |-
|
102
|
-
ELB configured for the instance does not exist
|
103
|
-
|
104
|
-
states:
|
105
|
-
short_not_created: |-
|
106
|
-
not created
|
107
|
-
long_not_created: |-
|
108
|
-
The EC2 instance is not created. Run `vagrant up` to create it.
|
109
|
-
|
110
|
-
short_stopped: |-
|
111
|
-
stopped
|
112
|
-
long_stopped: |-
|
113
|
-
The EC2 instance is stopped. Run `vagrant up` to start it.
|
114
|
-
|
115
|
-
short_stopping: |-
|
116
|
-
stopping
|
117
|
-
long_stopping: |-
|
118
|
-
The EC2 instance is stopping. Wait until is completely stopped to
|
119
|
-
run `vagrant up` and start it.
|
120
|
-
|
121
|
-
short_pending: |-
|
122
|
-
pending
|
123
|
-
long_pending: |-
|
124
|
-
The EC2 instance is pending a start (i.e. this is a transition state).
|
125
|
-
|
126
|
-
short_running: |-
|
127
|
-
running
|
128
|
-
long_running: |-
|
129
|
-
The EC2 instance is running. To stop this machine, you can run
|
130
|
-
`vagrant halt`. To destroy the machine, you can run `vagrant destroy`.
|
131
|
-
|
132
|
-
short_pending: |-
|
133
|
-
pending
|
134
|
-
long_pending: |-
|
135
|
-
The EC2 instance is still being initialized. To destroy this machine,
|
136
|
-
you can run `vagrant destroy`.
|
2
|
+
#currently unsupported, a placeholder
|
@@ -3,22 +3,9 @@ module VagrantPlugins
|
|
3
3
|
module Cap
|
4
4
|
class Unregister
|
5
5
|
def self.unregister(machine)
|
6
|
-
|
7
|
-
if machine.communicate.ready?
|
8
|
-
machine.communicate.execute("subscription-manager unregister || :", sudo: true)
|
9
|
-
end
|
10
|
-
end
|
6
|
+
machine.communicate.execute("subscription-manager unregister || :", sudo: true)
|
11
7
|
end
|
12
8
|
end
|
13
9
|
end
|
14
10
|
end
|
15
11
|
end
|
16
|
-
|
17
|
-
|
18
|
-
# if !machine.communicate.ready?
|
19
|
-
# raise Vagrant::Errors::VMNotCreatedError
|
20
|
-
# end
|
21
|
-
|
22
|
-
# rescue IOError
|
23
|
-
# Ignore, this probably means connection closed because it
|
24
|
-
# shut down.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure('2') do |config|
|
5
|
+
# Example configuration of new VM..
|
6
|
+
config.vm.define :vagrant_ident_centos do |vagrant_host|
|
7
|
+
# Box name
|
8
|
+
vagrant_host.vm.box = 'gildub/fedora20'
|
9
|
+
vagrant_host.vm.hostname = "vagrant_centos_ident_test"
|
10
|
+
|
11
|
+
config.vm.synced_folder ".", "/vagrant", type: "rsync",
|
12
|
+
rsync__exclude: [ ".git/", ".#*", "*~" ]
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure('2') do |config|
|
5
|
+
# Example configuration of new VM..
|
6
|
+
config.vm.define :vagrant_ident_fedora do |vagrant_host|
|
7
|
+
# Box name
|
8
|
+
vagrant_host.vm.box = 'gildub/fedora20'
|
9
|
+
vagrant_host.vm.hostname = "vagrant_fedora_ident_test"
|
10
|
+
|
11
|
+
config.vm.synced_folder ".", "/vagrant", type: "rsync",
|
12
|
+
rsync__exclude: [ ".git/", ".#*", "*~" ]
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure('2') do |config|
|
5
|
+
# Example configuration of new VM..
|
6
|
+
config.vm.define :vagrant_ident_rhel do |vagrant_host|
|
7
|
+
# Box name
|
8
|
+
vagrant_host.vm.box = 'rhel-7.0'
|
9
|
+
vagrant_host.vm.hostname = "vagrant_rhel_ident_test"
|
10
|
+
|
11
|
+
config.vm.synced_folder ".", "/vagrant", type: "rsync",
|
12
|
+
rsync__exclude: [ ".git/", ".#*", "*~" ]
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
export PATH="/bin:/usr/bin"
|
4
|
+
STATUS=0
|
5
|
+
|
6
|
+
echo "get the plugin installed"
|
7
|
+
vagrant plugin install vagrant-registration
|
8
|
+
|
9
|
+
echo "do we have any plugins now?"
|
10
|
+
exec 5>&1 && OUTPUT=$(vagrant plugin list | tee >(cat - >&5))
|
11
|
+
if [ $? -ne 0 ]; then
|
12
|
+
STATUS=$?
|
13
|
+
echo "No plugins at all: Vagrant plugin test FAILED"
|
14
|
+
exit $STATUS
|
15
|
+
fi
|
16
|
+
|
17
|
+
echo "do we have the vagrant-registration plugin?"
|
18
|
+
TEST=$(echo "$OUTPUT" | grep vagrant-registration)
|
19
|
+
STATUS=$?
|
20
|
+
if [ -z "$TEST" ]; then
|
21
|
+
echo "Plugin vagrant-registration did not get installed: Vagrant plugin test FAILED"
|
22
|
+
echo "Output of vagrant plugin list:\n$OUTPUT\n"
|
23
|
+
echo "Result of \"echo \$OUTPUT | grep vagrant-registration\":\n$TEST\n"
|
24
|
+
exit $STATUS
|
25
|
+
fi
|
26
|
+
|
27
|
+
echo "let's start with the fedora vagrantfile"
|
28
|
+
rm ./Vagrantfile
|
29
|
+
ln -s ./Vagrantfile.fedora ./Vagrantfile
|
30
|
+
|
31
|
+
echo "let's try and bring the machine up"
|
32
|
+
exec 5>&1 && OUTPUT=$(vagrant up | tee >(cat - >&5))
|
33
|
+
STATUS=$?
|
34
|
+
if [ $? -ne 0 ]; then
|
35
|
+
echo "Failed to bring up the machine: Launch FAILED"
|
36
|
+
exit $STATUS
|
37
|
+
fi
|
38
|
+
|
39
|
+
echo "let's test that we can connect"
|
40
|
+
OUTPUT=$(vagrant ssh -c 'echo \"connected!\"' | tee >(cat - >&5))
|
41
|
+
STATUS=$?
|
42
|
+
TEST=$(echo "$OUTPUT" | grep connected)
|
43
|
+
if [ -z "$TEST" ]; then
|
44
|
+
echo "Failed to connect to the machine: connect FAILED"
|
45
|
+
exit $STATUS
|
46
|
+
fi
|
47
|
+
|
48
|
+
echo "time to clean up fedora box"
|
49
|
+
vagrant destroy -f
|
50
|
+
rm -rf .vagrant.d Vagrantfile
|
51
|
+
|
52
|
+
echo "let's try the rhel box"
|
53
|
+
rm ./Vagrantfile
|
54
|
+
ln -s ./Vagrantfile.rhel ./Vagrantfile
|
55
|
+
|
56
|
+
echo "let's try and bring the machine up"
|
57
|
+
exec 5>&1 && OUTPUT=$(vagrant up | tee >(cat - >&5))
|
58
|
+
STATUS=$?
|
59
|
+
if [ $? -ne 0 ]; then
|
60
|
+
echo "Failed to bring up the machine: Launch FAILED"
|
61
|
+
exit $STATUS
|
62
|
+
fi
|
63
|
+
|
64
|
+
echo "let's test that we can connect"
|
65
|
+
OUTPUT=$(vagrant ssh -c 'echo \"connected!\"' | tee >(cat - >&5))
|
66
|
+
STATUS=$?
|
67
|
+
TEST=$(echo "$OUTPUT" | grep connected)
|
68
|
+
if [ -z "$TEST" ]; then
|
69
|
+
echo "Failed to connect to the machine: connect FAILED"
|
70
|
+
exit $STATUS
|
71
|
+
fi
|
72
|
+
|
73
|
+
echo "let's test that we are subscribed"
|
74
|
+
OUTPUT=$(vagrant ssh -c 'sudo subscription-manager status' | tee >(cat - >&5))
|
75
|
+
STATUS=$?
|
76
|
+
TEST=$(echo "$OUTPUT" | grep Current)
|
77
|
+
if [ -z "$TEST" ]; then
|
78
|
+
echo "We are not subscribed: subscribe FAILED"
|
79
|
+
exit $STATUS
|
80
|
+
fi
|
81
|
+
|
82
|
+
echo "time to clean up rhel box"
|
83
|
+
vagrant destroy -f
|
84
|
+
rm -rf .vagrant.d Vagrantfile
|
85
|
+
|
86
|
+
echo "test implementation incomplete"
|
87
|
+
exit;
|
88
|
+
|
89
|
+
echo "let's try the centos box"
|
90
|
+
rm ./Vagrantfile
|
91
|
+
ln -s ./Vagrantfile.centos ./Vagrantfile
|
92
|
+
|
93
|
+
echo "let's try and bring the machine up"
|
94
|
+
exec 5>&1 && OUTPUT=$(vagrant up | tee >(cat - >&5))
|
95
|
+
STATUS=$?
|
96
|
+
if [ $? -ne 0 ]; then
|
97
|
+
echo "Failed to bring up the machine: Launch FAILED"
|
98
|
+
exit $STATUS
|
99
|
+
fi
|
100
|
+
|
101
|
+
echo "let's test that we can connect"
|
102
|
+
OUTPUT=$(vagrant ssh -c 'echo \"connected!\"' | tee >(cat - >&5))
|
103
|
+
STATUS=$?
|
104
|
+
TEST=$(echo "$OUTPUT" | grep connected)
|
105
|
+
if [ -z "$TEST" ]; then
|
106
|
+
echo "Failed to connect to the machine: connect FAILED"
|
107
|
+
exit $STATUS
|
108
|
+
fi
|
109
|
+
|
110
|
+
echo "time to clean up rhel box"
|
111
|
+
vagrant destroy -f
|
112
|
+
rm -rf .vagrant.d Vagrantfile
|
113
|
+
|
114
|
+
echo "tests complete!"
|
@@ -5,11 +5,11 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.name = "vagrant-registration"
|
6
6
|
s.version = VagrantPlugins::Registration::VERSION
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
|
-
s.license = "
|
9
|
-
s.authors = "Langdon White"
|
8
|
+
s.license = "GPL-2.0"
|
9
|
+
s.authors = ["Langdon White", "et al"]
|
10
10
|
s.email = "langdon@fedoraproject.org"
|
11
11
|
s.summary = "Enables guests to have a registration capability"
|
12
|
-
s.description = "Enables guests to have a registration capability"
|
12
|
+
s.description = "Enables guests to have a registration capability, this is expecially useful on RHEL or SLES"
|
13
13
|
|
14
14
|
s.required_rubygems_version = ">= 1.3.6"
|
15
15
|
s.rubyforge_project = "vagrant-registration"
|
metadata
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-registration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Langdon White
|
8
|
+
- et al
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-01-13 00:00:00.000000000 Z
|
12
13
|
dependencies: []
|
13
|
-
description: Enables guests to have a registration capability
|
14
|
+
description: Enables guests to have a registration capability, this is expecially
|
15
|
+
useful on RHEL or SLES
|
14
16
|
email: langdon@fedoraproject.org
|
15
17
|
executables: []
|
16
18
|
extensions: []
|
@@ -37,10 +39,14 @@ files:
|
|
37
39
|
- plugins/guests/redhat/cap/register.rb
|
38
40
|
- plugins/guests/redhat/cap/unregister.rb
|
39
41
|
- plugins/guests/redhat/plugin.rb
|
42
|
+
- tests/shell-scripts/test-rhel-eco-ident/Vagrantfile.centos
|
43
|
+
- tests/shell-scripts/test-rhel-eco-ident/Vagrantfile.fedora
|
44
|
+
- tests/shell-scripts/test-rhel-eco-ident/Vagrantfile.rhel
|
45
|
+
- tests/shell-scripts/test-rhel-eco-ident/test-identification.sh
|
40
46
|
- vagrant-registration.gemspec
|
41
47
|
homepage:
|
42
48
|
licenses:
|
43
|
-
-
|
49
|
+
- GPL-2.0
|
44
50
|
metadata: {}
|
45
51
|
post_install_message:
|
46
52
|
rdoc_options: []
|