projectatomic / adb-vagrant-registration Goto Github PK
View Code? Open in Web Editor NEWA plugin to add "register" and "unregister" capabilities to Vagrant guests.
License: GNU General Public License v2.0
A plugin to add "register" and "unregister" capabilities to Vagrant guests.
License: GNU General Public License v2.0
[lmohanty@LalatenduM-laptop centos-atomic]$ vagrant init centos/atomic-host
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
[lmohanty@LalatenduM-laptop centos-atomic]$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Box 'centos/atomic-host' could not be found. Attempting to find and install...
default: Box Provider: libvirt
default: Box Version: >= 0
==> default: Loading metadata for box 'centos/atomic-host'
default: URL: https://atlas.hashicorp.com/centos/atomic-host
==> default: Adding box 'centos/atomic-host' (v7.20160531) for provider: libvirt
default: Downloading: https://atlas.hashicorp.com/centos/boxes/atomic-host/versions/7.20160531/providers/libvirt.box
==> default: Successfully added box 'centos/atomic-host' (v7.20160531) for 'libvirt'!
==> default: Uploading base box image as volume into libvirt storage...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default: -- Name: centos-atomic_default
==> default: -- Domain type: kvm
==> default: -- Cpus: 1
==> default: -- Memory: 512M
==> default: -- Management MAC:
==> default: -- Loader:
==> default: -- Base box: centos/atomic-host
==> default: -- Storage pool: default
==> default: -- Image: /var/lib/libvirt/images/centos-atomic_default.img (11G)
==> default: -- Volume Cache: default
==> default: -- Kernel:
==> default: -- Initrd:
==> default: -- Graphics Type: vnc
==> default: -- Graphics Port: 5900
==> default: -- Graphics IP: 127.0.0.1
==> default: -- Graphics Password: Not defined
==> default: -- Video Type: cirrus
==> default: -- Video VRAM: 9216
==> default: -- Keymap: en-us
==> default: -- TPM Path:
==> default: -- INPUT: type=mouse, bus=ps2
==> default: -- Command line :
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Registering box with vagrant-registration...
default: Would you like to register the system now (default: yes)? [y|n]n
==> default: Configuring and enabling network interfaces...
When a user has the vbguest plugin installed the startup of the VM won't work. The vbguest plugin seems to run prior to the registration plugin and tries to run a yum command. This will lead to an error like this:
==> default: Machine booted and ready!
No installation found.
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable <repo>
==> default: Checking for guest additions in VM...
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
yum install -y kernel-devel-`uname -r` gcc make perl bzip2
Stdout from the command:
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Stderr from the command:
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable <repo>
As a workaround one can set config.vbguest.auto_update = false
.
I don't know whether there is a way to ensure a specific order in plugin execution, but it might be at least worth documenting.
For incorrect password provided during vagrant registration, it exits without proper clean up. So on subsequent "vagrant up", it directly comes up with out proper msg on the screen.
[pavan@dhcp35-202 rhel-ose]$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
==> default: Creating shared folders metadata...
==> default: Registering box with vagrant-registration...
default: Would you like to register the system now (default: yes)? [y|n]y
default: username: pavan
default: password:
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html
Registering to: subscription.rhn.redhat.com:443/subscription
[pavan@dhcp35-202 rhel-ose]$ vagrant global-status | grep default
31043fc default libvirt shutoff /home/pavan/Downloads/cdk/components/rhel/rhel-ose
da2ab7e default libvirt running /home/pavan/Downloads/cdk/components/rhel/misc/rhel-k8s-singlenode-setup
-> Vagrant up comes up directly without displaying the necessary information on the screen.
[pavan@dhcp35-202 rhel-ose]$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
[pavan@dhcp35-202 rhel-ose]$ vagrant global-status | grep default
31043fc default libvirt running /home/pavan/Downloads/cdk/components/rhel/rhel-ose
da2ab7e default libvirt running /home/pavan/Downloads/cdk/components/rhel/misc/rhel-k8s-singlenode-setup
[pavan@dhcp35-202 rhel-ose]$
Analysis of vagrant-registration plugin
Here's a quick analysis of this vagrant-registration plugin. I didn't look at the code very much, so most of this is based on the README, and conceptual issues as opposed to coding style.
The idea of doing this type of work in a vagrant plugin is a good idea!
Storing username/password in env vars is a bad idea (TM).
You are better off using the approach used by Oh-My-Vagrant! [1] They come from an XDG defined config file in the user's $HOME.
Better yet, if subscription-manager could offer the user an "API key" style method of authentication, then it would be wholly better all around :) I'm not an expert on subscription-manager, so I'm not sure of the answer.
A fundamental flaw in the current approach is that there's no way to tie in machine specific additional details. For example, for the username/password it's okay for it to be global (not technically correct, but acceptable).
Additionally, only doing registration is not usually sufficient. It probably also makes sense to specify a pool-id (or auto-attach) and a list of repos to activate. Both of these need to be per machine specific. As a result, integration into a Vagrantfile is needed.
One such project already does this: Oh-My-Vagrant [1]. If it could all be done with a plugin, then this part of Oh-My-Vagrant wouldn't be needed, but since this is not yet possible with this plugin, and a user might want to use Oh-My-Vagrant anyways, they won't need this plugin because it would unnecessarily split the subscription manager work between a complete, and incomplete piece of software.
The more general fix is to actually have a declarative option available to do this in the Vagrantfile. Eg:
#config.registration.username = file # should be implied #config.registration.password = file # should be implied config.registration.set_box_url_automatically = true # TODO config.vm.define 'some_hostname' do |vm| vm.vm.hostname = 'some_hostname' vm.vm.registration.auto_attach = true vm.vm.registration.repos = [...] end
Once this exists, it would make sense to port Oh-My-Vagrant to use this. I'll wait for your patch! :)
Cheers and Happy hacking!
James
@purpleidea
[pavan@dhcp35-202 rhel-ose]$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default: -- Name: rhel-ose_default
==> default: -- Domain type: kvm
==> default: -- Cpus: 2
==> default: -- Memory: 1024M
==> default: -- Management MAC:
==> default: -- Loader:
==> default: -- Base box: cdkv2
==> default: -- Storage pool: default
==> default: -- Image: /var/lib/libvirt/images/rhel-ose_default.img (41G)
==> default: -- Volume Cache: default
==> default: -- Kernel:
==> default: -- Initrd:
==> default: -- Graphics Type: vnc
==> default: -- Graphics Port: 5900
==> default: -- Graphics IP: 127.0.0.1
==> default: -- Graphics Password: Not defined
==> default: -- Video Type: cirrus
==> default: -- Video VRAM: 9216
==> default: -- Keymap: en-us
==> default: -- TPM Path:
==> default: -- INPUT: type=mouse, bus=ps2
==> default: -- Command line :
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Configuring and enabling network interfaces...
==> default: Registering box with vagrant-registration...
default: Would you like to register the system now (default: yes)? [y|n]
default: username: ^C==> default: Waiting for cleanup before exiting...
^C==> default: Exiting immediately, without cleanup!
[pavan@dhcp35-202 rhel-ose]$
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
cmd=$(subscription-manager register --username=USERNAME_HERE --password=PASSWORD_HERE --auto-attach); if [ "$?" != "0" ]; then echo $cmd | grep 'This system is already registered' || (echo $cmd 1>&2 && exit 1) ; fi
Stdout from the command:
Stderr from the command:
This system is already registered. Use --force to override
The default of config.registration.unregister_on_halt
should be false
. It makes more sense to just un-register on destroy. If one really wants to un-register on halt, one can explicitly set it.
This plugin tries to run the subscription-manager register via the shell and it passes the username/password on the command line as arguments. If your password has a $ in it then this doesn't work as the shell tries to interpret the $ as a variable.
This may be broken for other characters other than $.
The README is quite long and contains information which is not directly relevant for the user or developer. It should be shortened and information which is still valuable, but not suitable for the README should be moved to for example wiki pages.
I got the following error message:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
cmd=$(subscription-manager register --username='[email protected]' --password='<this was my cleartext passowrd>' --auto-attach --force); if [ "$?" != "0" ]; then echo $cmd | grep 'This system is already registered' || (echo $cmd 1>&2 && exit 1) ; fi
Stdout from the command:
Stderr from the command:
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html
Registering to: subscription.rhn.redhat.com:443/subscription
Funny enough the username and password were actually correct, so registration must have failed due to another error.
No success message after vagrant up for rhel-k8s-singlenode-setup
Steps to reproduce
default: Running provisioner: shell... default: Running: inline script
`
If by mistake user hits enter at the password prompt i.e blank pwd, the error msg needs to be filtered and handled well. Currently, we see the getpass.py script error on the screen.
See below:
[pavan@dhcp35-202 rhel-ose]$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
==> default: Creating shared folders metadata...
==> default: Registering box with vagrant-registration...
default: Would you like to register the system now (default: yes)? [y|n]y
default: username: [email protected]
default: password:
/usr/lib64/python2.7/getpass.py:83: GetPassWarning: Can not control echo on the terminal.
passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
Password:
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html
Registering to: subscription.rhn.redhat.com:443/subscription
It seems when I try to bring up a CentOS Atomic host (link) and I have the vagrant-registration plugin installed then I get prompted to register the machine. We probably need to handle this better:
vanilla-c7atomic: Would you like to register the system now (default: yes)? [y|n]
Versions: I really don't know what versions of software are being used. I have them installed in the system but they are also in the vagrant plugins directories. It seems that vagrant upgrades all plugins when you just install a new one etc.. Here is what I have:
$ rpm -q vagrant vagrant-libvirt vagrant-registration
vagrant-1.7.2-12.fc22.noarch
vagrant-libvirt-0.0.26-3.fc22.noarch
vagrant-registration-1.1.0-2.fc22.noarch
$ ls /guests/vagrant.d/gems/gems/ | grep -P "vagrant-libvirt|vagrant-registration"
vagrant-libvirt-0.0.31
vagrant-registration-1.2.1
I'd like to be able to register the machine using activation key.
To be able to do so I have to be able to set ORG_KEY and ACTIVATION_KEY parameters and registration plugin should run
'sudo subscription-manager register --org=ORG_KEY --activationkey=ACTIVATION_KEY --auto-attach'
aka reregistration. In some situations it would be helpful to force a registration of a VM.
on https://rubygems.org/gems/vagrant-registration license is shown to be apache2, this repository says GPL2.
Currently, the hook for the subscribing/registering is firing after the provision step. If you don't have provisioning you won't see this problem.
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
Running vagrant up --debug
shows subscription fails with:
INFO ssh: Execute: /sbin/subscription-manager (sudo=true)
DEBUG ssh: stderr: bash: line 2: /sbin/subscription-manager: No such file or directory
DEBUG ssh: Exit status: 127
DEBUG register: Registration manager not found on guest
On the system subscription-manager has these locations:
$ ls -l /usr/sbin/subscription-manager
-rwxr-xr-x. 1 root root 2668 Jun 9 17:58 /usr/sbin/subscription-manager
$ ls -l /usr/bin/subscription-manager
lrwxrwxrwx. 1 root root 22 Aug 1 00:36 /usr/bin/subscription-manager -> /usr/bin/consolehelper
As a work-around, I can make subscription work if I symlink to the expected location:
$ sudo ln -s /usr/sbin/subscription-manager /sbin
We can use the same infrastructure as for vagrant-service-mananager - https://ci.centos.org/job/vagrant-service-manager/
If I use registration plugin without saved ceredentials (in Vagrantfile), I have just one try to fill username and password correctly and if I make error, I have to do "vagrant halt && vagrant up".
It would be nice if this plugin support one of this options:
Currently, plain string is passed as message for logging, info, error message etc. Example here.
Use Vagrant way to pass messages using locale
based which help is re-usability of these messages.
see goern/vagrant-libvirt-testing#1 for a test case
I'm trying to use this plugin to allow vagrant boxes to be registered against our internal Katello server. To achieve this I added the following parameters to the Vagrantfile:
config.registration.serverurl = 'https://katello.foo.bar/rhsm'
config.registration.org = 'Default Organization'
config.registration.activationkey = 'ak-rhel-guest'
This currently fails with the following error:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
cmd=$(subscription-manager register --serverurl='https://katello.foo.bar/rhsm' --org='Default Organization' --activationkey='ak-rhel-guest' --force); if [ "$?" != "0" ]; then echo $cmd | grep 'This system is already registered' || (echo $cmd 1>&2 && exit 1) ; fi
Stdout from the command:
Stderr from the command:
Error: CA certificate for subscription service has not been installed.
Could you please add support for supplying a CA certificate or the location of the CA certificate RPM (for example http://katello.foo.bar/pub/katello-ca-consumer-latest.noarch.rpm) and make sure it is configured inside the guest properly before trying to do the actual 'subscription-manager register' ?
Following up on issue #40 which does not seem to be resolved yet.
Installed vagrant-registration (1.2.1) and vagrant-vbguest (0.11.0) on OS X and Windows 10 and tried to start VM (Vagrantfile as of openshift-vagrant). In both cases I get:
$vagrant up
Red Hat subscription credentials are needed for this VM.
You can supply them interactively or by setting environment variables.
Set these environment variables to your subscription username/password to avoid interactive registration:
$ export SUB_USERNAME=rhn-username
$ export SUB_PASSWORD=password
Bringing machine 'cdk' up with 'virtualbox' provider...
==> cdk: Importing base box 'cdk_v2'...
==> cdk: Matching MAC address for NAT networking...
==> cdk: Setting the name of the VM: openshift.cdk-2
==> cdk: Clearing any previously set network interfaces...
==> cdk: Preparing network interfaces based on configuration...
cdk: Adapter 1: nat
cdk: Adapter 2: hostonly
==> cdk: Forwarding ports...
cdk: 22 => 2222 (adapter 1)
==> cdk: Running 'pre-boot' VM customizations...
==> cdk: Booting VM...
==> cdk: Waiting for machine to boot. This may take a few minutes...
cdk: SSH address: 127.0.0.1:2222
cdk: SSH username: vagrant
cdk: SSH auth method: private key
cdk: Warning: Connection timeout. Retrying...
cdk:
cdk: Vagrant insecure key detected. Vagrant will automatically replace
cdk: this with a newly generated keypair for better security.
cdk:
cdk: Inserting generated public key within guest...
cdk: Removing insecure key from the guest if it's present...
cdk: Key inserted! Disconnecting and reconnecting using new SSH key...
==> cdk: Machine booted and ready!
No installation found.
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable <repo>
==> cdk: Checking for guest additions in VM...
cdk: No guest additions were detected on the base box for this VM! Guest
cdk: additions are required for forwarded ports, shared folders, host only
cdk: networking, and more. If SSH fails on this machine, please install
cdk: the guest additions and repackage the box to continue.
cdk:
cdk: This is not an error message; everything may continue to work properly,
cdk: in which case you may ignore this message.
==> cdk: [vagrant-hostsupdater] Checking for host entries
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
yum install -y kernel-devel-`uname -r` gcc make perl bzip2
Stdout from the command:
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Stderr from the command:
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable <repo>
Seems vbguest still runs prior to registration.
Under a Cygwin installation on Windows (the terminal window is Mintty, running bash by default), the password is echoed. There is a message about fixing your stdin.
It seems like something isn't quite working right. The terminal is functional enough that other programs like ssh (openssh) for example, doesn't have a problem changing the terminal settings to disable echo.
I'm not sure where to start debugging this. The cygwin environment includes stty
.
I have a vague recollection of this working properly in the past, possibly in the 1.0 time frame.
It would be nice to add a "pool" parameter to attach to a specific pool.
While it seems to be an ok feature to allow for multiple machines to have different credentials, if there are global credentials and no per machine credentials, the global credentials should be used.
Currently registration is bound to life cycle events. However, the plugin should also offer explicit commands to register and un-register. Something like vagrant registration register
and vagrant registration unregister`.
There is a lot of useful parts of code for configuration in readme, but none of them can work outside of this block:
Vagrant.configure('2') do |config|
...
end
This should be clearly documented
Would be nice to have a "getting started" from start to finish (step by step) in the README, or some other place like docs/ so people how haven't registered capabilities before know where and how to get started here. I'd be happy to help, but unfortunately I don't know the steps myself yet.
config.registration.subscriber_username
and config.registration.subscriber_password
were the configuration entries for passing subscription credentials up to version 0.0.9 of the plugin. Now it is config.registration.username
and config.registration.password
.
Looking at commit #573dd0d206dfacd863fc5fc00f958100dc94a4ff, it seems the intention was to still allow the old keys in order to stay backwards compatible. However, in its latest version 0.0.19 these configuration options get silently ignored. I think they should be accepted or at least a warning should be logged forcing you to change the values.
We have couple of commits post the last release and we should do a release with the current code.
CC @pvalena @hferentschik @budhrg
Tasks for the release
It would be nice to add support for enabling or disabling repos
As we are encouraging users to register in http://developers.redhat.com/ and use the password for registering CDK to RHN , the prompt should clearly communicate it to the user. In current state user might get confused which user name/password he supposed to enter. The ideal solution would be using the same terminology as official CDK documentation
$ vagrant up
xxxxxxxxxxxxxxxxx
==> default: Registering box with vagrant-registration...
default: Would you like to register the system now (default: yes)? [y|n]y
default: username:
Wouldn't be useful a flag that doesn't unregister the environment when you halt it, but only when you destroy it?
If it is registered, there is no need to call registration again.
vargant-registration
with subscription-manager
should not require username/password
combination when used with org/activationkey
pair.
May be "vagrant-rsm-registration" (rsm = Red Hat subscription manager)
OR "vagrant-redhat-registration"
I am getting the following on the first vagrant up
:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
cmd=$(subscription-manager register [email protected] --password=****** --auto-attach); if [ "$?" != "0" ]; then echo $cmd | grep 'This system is already registered' || (echo $cmd 1>&2 && exit 1) ; fi
Stdout from the command:
Stderr from the command:
The system has been registered with ID: 94f79c63-efd6-49ab-af77-ee4bf5ecd0f0 Installed Product Current Status: Product Name: Red Hat Enterprise Linux Server Status: Not Subscribed
It eventually says Server Status: Not Subscribed and fails. Not sure why it happens to me. Anyone else came across this?
Edit: the second attemp usually passes.
In reference to this issue #79 , the user should able to choose whether he should continue without subscription or not after entering invalid username/password
pair 3 times.
Expected behavior:
Invalid username/password. Continue without Subscription (y or n):
When trying to register with a provided CA cert file, the following error is dumped on the console:
/tmp/.vagrant.d/gems/gems/vagrant-registration-1.1.0/plugins/guests/redhat/cap/rhn_register.rb:84:in `rhn_register_upload_certificate': undefined local variable or method `tmp' for VagrantPlugins::GuestRedHat::Cap::RhnRegister:Class (NameError)
from /tmp/.vagrant.d/gems/gems/vagrant-registration-1.1.0/plugins/guests/redhat/cap/rhn_register.rb:20:in `rhn_register_register'
Hi! I'm not sure if this is an appropriate channel for reporting a problem, but perhaps someone will see it and have an idea about what's going wrong.
For some reason, destroy
with either kitchen
or vagrant
is no longer properly unsubscribing and deregistering Red Hat instances for us. I think it was working prior to Saturday, December 19, but then again, it might just be that I hadn't yet hit our Red Hat developer subscription limit of 100 active units over the week that I'd been using the Red Hat Vagrant box and vagrant-registration plugin.
In any case, here are the versions in use on my MacBook Pro, which is running OS X 10.11.2 (15C50):
I can confirm that when I kitchen converge
using my Red Hat Vagrant box, my subscription is set up properly. I store my Red Hat credentials in my global Vagrantfile
. I can verify the subscription with subscription-manager
after I connect to the instance via SSH, and the instance is listed as consuming a unit of our developer license on Red Hat's Subscription Units page.
If I kitchen destroy
(or vagrant destroy
), however, my subscription is still consumed when I check the Subscription Units page. My colleague, who's using Red Hat's VirtualBox box from the Container Development Kit, also experiences this problem.
Is this known? Is there some information I can provide so that someone can help out?
Thanks!
Finally got my recognition in bec4e9e -- I just saw this by accident today, so I guess it was rolled in quietly, but thanks to @whitel for finally doing the right thing!
In any case, now that that's out of the way, if someone is interested in patching https://github.com/purpleidea/oh-my-vagrant so it can use this plugin, please do! AFAICT, the biggest missing feature is getting the password from a file, instead of having to hardcode it into vagrant. Perhaps this might be a useful design/feature for vagrant-registration?
Please have a look, and if you like, and as long as it's feature complete, then it would probably make sense to avoid having two different methods to do vagrant registration.
If nobody is interested in doing this feature, please feel free to LMK and close the ticket, since from oh-my-vagrant's perspective, subscription manager is already working perfectly.
Cheers,
James
VM spin up(vagrant up) with invalid subscription username/password and kubernates,openshift was in stopped state. No Success message after spinning up vm
There must be a handle to check for valid subscription
Either it should spin up machine with kubernates ,openshift , docker running with success message or throw error of invalid username/password and dont spin up vm
[naina@dhcp35-1 rhel-ose]$ vagrant destroy
==> default: Unregistering box with vagrant-registration...
==> default: Removing domain...
[naina@dhcp35-1 rhel-ose]$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default: -- Name: rhel-ose_default
==> default: -- Domain type: kvm
==> default: -- Cpus: 2
==> default: -- Memory: 3072M
==> default: -- Management MAC:
==> default: -- Loader:
==> default: -- Base box: cdkv2
==> default: -- Storage pool: default
==> default: -- Image: /var/lib/libvirt/images/rhel-ose_default.img (41G)
==> default: -- Volume Cache: default
==> default: -- Kernel:
==> default: -- Initrd:
==> default: -- Graphics Type: vnc
==> default: -- Graphics Port: 5900
==> default: -- Graphics IP: 127.0.0.1
==> default: -- Graphics Password: Not defined
==> default: -- Video Type: cirrus
==> default: -- Video VRAM: 9216
==> default: -- Keymap: en-us
==> default: -- INPUT: type=mouse, bus=ps2
==> default: -- Command line :
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Configuring and enabling network interfaces...
==> default: Registering box with vagrant-registration...
default: Would you like to register the system now (default: yes)? [y|n]y
default: username: ytyyt
default: password:
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html
Registering to: subscription.rhn.redhat.com:443/subscription
[naina@dhcp35-1 rhel-ose]$ vagrant ssh
[vagrant@rhel-cdk ~]$
[vagrant@rhel-cdk ~]$ exit
logout
Connection to 192.168.121.251 closed.
[naina@dhcp35-1 rhel-ose]$ vagrant service-manager env openshift
# OpenShift service is not running in the vagrant box.
[naina@dhcp35-1 rhel-ose]$
[naina@dhcp35-1 rhel-ose]$
[naina@dhcp35-1 rhel-ose]$
[naina@dhcp35-1 rhel-ose]$ vagrant service-manager env
Configured services:
docker - running
openshift - stopped
kubernetes - stopped
docker env:
# Copying TLS certificates to /home/naina/Documents/cdk/components/rhel/rhel-ose/.vagrant/machines/default/libvirt/docker
# Set the following environment variables to enable access to the
# docker daemon running inside of the vagrant virtual machine:
export DOCKER_HOST=tcp://10.1.2.2:2376
export DOCKER_CERT_PATH=/home/naina/Documents/cdk/components/rhel/rhel-ose/.vagrant/machines/default/libvirt/docker
export DOCKER_TLS_VERIFY=1
export DOCKER_API_VERSION=1.21
# run following command to configure your shell:
# eval "$(vagrant service-manager env docker)"
[naina@dhcp35-1 rhel-ose]$ vagrant global-status
id name provider state directory
-----------------------------------------------------------------------------------------------------------
72a836a default libvirt running /home/naina/Documents/cdk/components/rhel/misc/rhel-k8s-singlenode-setup
4b0aa6d default libvirt running /home/naina/Documents/cdk/components/rhel/rhel-ose
[naina@dhcp35-1 rhel-ose]$ tail -f /var/log/rhsm/rhsm.log
<NONE>
Deleted
<NONE>
2016-05-02 18:24:56,681 [INFO] rhsmcertd-worker:3229 @hwprobe.py:908 - collected virt facts: virt.is_guest=False, virt.host_type=Not Applicable, virt.uuid=Not Set
2016-05-02 18:24:57,715 [INFO] rhsmcertd-worker:3229 @hwprobe.py:908 - collected virt facts: virt.is_guest=False, virt.host_type=Not Applicable, virt.uuid=Not Set
2016-05-02 18:25:00,813 [INFO] rhsmcertd-worker:3229 @factlib.py:103 - Facts have been updated.
2016-05-03 10:21:01,897 [INFO] rhsmd:12700 @rhsmd:235 - rhsmd started
2016-05-03 10:21:01,898 [INFO] rhsmd:12700 @rhsmd:266 - logging subscription status to syslog
2016-05-03 10:21:01,902 [INFO] rhsmd:12700 @connection.py:815 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ verify=False
2016-05-03 10:21:05,174 [INFO] rhsmd:12700 @cert_sorter.py:205 - Product status: valid_products= partial_products= expired_products= unentitled_producs= future_products= valid_until=None
I think this is related to the hooking, like the hook I want is not being triggered on "destroy only".
It would be nice to have parameters to specify proxies, because I've tried vagrant-proxy but it set the proxy after vagrant-registration plugin :(
If plugin is configured to expect username and password from environment in some variables, (almost) every vagrant command crashes with ruby syntax error.
In this case It can fixed by providing such variables or reconfiguring plugin.
Plugin should check if variables are set and are sane (no syntax error).
I can see no reason to strictly require passing RHN credentials for commands like "vagrant status" or "vagrant halt".
Output:
$ vagrant status
/home/optak/.vagrant.d/gems/gems/vagrant-registration-1.0.0/lib/vagrant-registration/config.rb:26:in eval': (eval):1: syntax error, unexpected end-of-input (SyntaxError) @conf.username= ^ from /home/optak/.vagrant.d/gems/gems/vagrant-registration-1.0.0/lib/vagrant-registration/config.rb:26:in
method_missing'
from /home/optak/.vagrant.d/Vagrantfile:2:in block in <top (required)>' from /usr/share/vagrant/lib/vagrant/config/v2/loader.rb:37:in
call'
from /usr/share/vagrant/lib/vagrant/config/v2/loader.rb:37:in load' from /usr/share/vagrant/lib/vagrant/config/loader.rb:103:in
block (2 levels) in load'
from /usr/share/vagrant/lib/vagrant/config/loader.rb:97:in each' from /usr/share/vagrant/lib/vagrant/config/loader.rb:97:in
block in load'
from /usr/share/vagrant/lib/vagrant/config/loader.rb:94:in each' from /usr/share/vagrant/lib/vagrant/config/loader.rb:94:in
load'
from /usr/share/vagrant/lib/vagrant/vagrantfile.rb:28:in initialize' from /usr/share/vagrant/lib/vagrant/environment.rb:691:in
new'
from /usr/share/vagrant/lib/vagrant/environment.rb:691:in vagrantfile' from /usr/share/vagrant/lib/vagrant/environment.rb:441:in
host'
from /usr/share/vagrant/lib/vagrant/environment.rb:207:in block in action_runner' from /usr/share/vagrant/lib/vagrant/action/runner.rb:33:in
call'
from /usr/share/vagrant/lib/vagrant/action/runner.rb:33:in run' from /usr/share/vagrant/lib/vagrant/environment.rb:428:in
hook'
from /usr/share/vagrant/lib/vagrant/environment.rb:673:in unload' from /usr/share/vagrant/bin/vagrant:177:in
ensure in
When using OpenStack as a provider the vagrant-registration plugin doesn't seem to run:
$ vup --provider=openstack Bringing machine 'jhunt-sat62' up with 'openstack' provider... ==> jhunt-sat62: Finding flavor for server... ==> jhunt-sat62: Finding image for server... ==> jhunt-sat62: Launching a server with the following settings... ==> jhunt-sat62: -- Tenant : GSS TAM ==> jhunt-sat62: -- Name : jhunt-sat62 ==> jhunt-sat62: -- Flavor : m1.small ==> jhunt-sat62: -- FlavorRef : 83098b08-7339-4089-bc07-3f2a14b7a4c1 ==> jhunt-sat62: -- Image : rhel-guest-image-7.1-20150224.0.x86_64 ==> jhunt-sat62: -- ImageRef : da47214f-5a10-4d44-8175-cfaf354b1148 ==> jhunt-sat62: -- KeyPair : jhunt-key ==> jhunt-sat62: Waiting for the server to be built... /home/jhunt/.vagrant.d/gems/gems/vagrant-openstack-provider-0.7.2/lib/vagrant-openstack-provider/action/create_server.rb:134:in
waiting_for_server_to_be_built': Object#timeout is deprecated, use Timeout.timeout instead.
==> jhunt-sat62: Using floating IP 10.3.11.65
==> jhunt-sat62: Waiting for machine to boot. This may take a few minutes...
jhunt-sat62: SSH address: 10.3.8.173:22
jhunt-sat62: SSH username: cloud-user
jhunt-sat62: SSH auth method: private key
jhunt-sat62: Warning: Connection refused. Retrying...
==> jhunt-sat62: Machine booted and ready!
==> jhunt-sat62: Rsyncing folder: /home/jhunt/vagrant/openstack-satellite/ => /vagrant
==> jhunt-sat62: Setting time zone...
`
But on a destroy, it does try to unregister....
$ vdestroy ==> jhunt-sat62: Unregistering box with vagrant-registration... ==> jhunt-sat62: Deleting server... ==> jhunt-sat62: Waiting for the server to be deleted...
* INFO config: Evaluating registration configuration: @conf.manager*
DEBUG ssh: Checking whether SSH is ready...
DEBUG ssh: Re-using SSH connection.
INFO ssh: SSH is ready!
DEBUG ssh: Re-using SSH connection.
INFO ssh: Execute: (sudo=false)
DEBUG ssh: Exit status: 0
DEBUG guest: Searching for cap: subscription_manager
DEBUG guest: Checking in: redhat
DEBUG guest: Found cap: subscription_manager in redhat
DEBUG ssh: Checking whether SSH is ready...
DEBUG ssh: Re-using SSH connection.
INFO ssh: SSH is ready!
DEBUG ssh: Re-using SSH connection.
INFO ssh: Execute: (sudo=false)
DEBUG ssh: Exit status: 0
DEBUG guest: Searching for cap: subscription_manager
DEBUG guest: Checking in: redhat
DEBUG guest: Found cap: subscription_manager in redhat
INFO guest: Execute capability: subscription_manager #<Vagrant::Machine: vagrant-rhel7 (VagrantPlugins::ProviderVirtualBox::Provider)>
DEBUG ssh: Re-using SSH connection.
INFO ssh: Execute: /usr/sbin/subscription-manager (sudo=false)
DEBUG ssh: stderr: Error: this command requires root access to execute
DEBUG ssh: Exit status: 8
DEBUG register: Registration manager not found on guest
INFO config: Evaluating registration configuration: @conf.skip
INFO warden: Calling OUT action: #VagrantPlugins::Registration::Action::Register:0x000001029453b0
When you have a running vagrant box (cdk) and then you restart your machine, your vagrant box will appear in a strange state.
In my case it will be aborted:
$ vagrant status
Current machine states:
default aborted (virtualbox)
This is because apparently when I go for shutdown in OS X, virtualbox will simply kill the VMs.
When I then do "vagrant up", cdk starts again, but there will be no registration happening.
(When I then do "vagrant halt" and "vagrant up", registration will happen again.)
But even if I just do ACPI Shutdown in VirtualBox, the machine state will be stopped, but on a consequent "vagrant up", there will be no registration. All the other things that usually happen on "vagrant up" will happen.
Even when no registration happens during "vagrant up", the subscription manager still returns this:
$ sudo subscription-manager status
+-------------------------------------------+
System Status Details
+-------------------------------------------+
Overall Status: Current
So maybe it's all good and it's actually still registered because it was not unregistered during shutdown? In that case this issue can be simply closed. But I wanted to be sure.
This was first spotted by @mlabuda as he regularly shuts down his laptop when leaving the office for the day. Very often he doesn't think to "vagrant halt" first.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.