Git Product home page Git Product logo

adb-vagrant-registration's People

Contributors

asouini avatar coolbrg avatar dtschan avatar goern avatar hferentschik avatar humaton avatar iconoeugen avatar kre80r avatar lalatendumohanty avatar langdon avatar praveenkumar avatar pvalena avatar seth-reeser avatar strzibny avatar thatdocslady avatar voxik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adb-vagrant-registration's Issues

vagrant-registration trying to register CentOS atomic host

[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...

vagrant-registration does not work in conjunction with the vagrant-vbguest plugin

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.

vagrant up has issues on Fedora on second attempt after failed registration

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

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! :)

  • Having this project is nice, but it's ultimately useless if there aren't RHEL vagrant boxes readily available. I think that instead of investing time on this, making a community RHEL vagrant box available is more important. This way, once it exists, the community might even come up with this sort of plugin on their own. Additionally, they'll be able to review and test it or this, and we'll get more eyes on the code.
  • The idea for this project was obviously based off the idea I had to do automatic registration in Oh-My-Vagrant. Stealing ideas from my code is encouraged, but it's usually classy to also put a note in the README file, or in the THANKS file.

Cheers and Happy hacking!
James
@purpleidea

[1] https://github.com/purpleidea/oh-my-vagrant

Interrupt during registration hangs

Interrupt vagrant up, ctrl+C while running "vagrant up"

If interrupt while it asks for username during registration, It just hangs there..


[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...

After 20 mins , I did send another interrupt signal (ctrl+C) and it exits immediately without clean up.


default: username: ^C==> default: Waiting for cleanup before exiting...

^C==> default: Exiting immediately, without cleanup!
[pavan@dhcp35-202 rhel-ose]$


rhel7 system doesnt get unregistered (maybe)

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

Passwords with dollar signs are improperly handled.

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 $.

Move non essential plugin information into wiki pages

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.

If an error occurs during registration the subscription password is printed clear text

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

No success message after vagrant up for rhel-k8s-singlenode-setup

Steps to reproduce

  1. go to /cdk/components/rhel/misc/rhel-k8s-singlenode-setup
  2. do vagrant up
  3. yes to registration or no (same behavior )
    Expected :it is not showing any successful configuration message for k8 single node as it give for rhel-ose
    Actual result :
    default: Running provisioner: shell... default: Running: inline script
    It should give message at end "k8-single-node-setup configured successfully"
    logs
    `$ vagrant.exe up
    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Importing base box 'cdkv2'...
    ==> default: Matching MAC address for NAT networking...
    ==> default: Setting the name of the VM: rhel-k8s-singlenode-setup_default_1465299221180_92959
    ==> default: Fixed port collision for 22 => 2222. Now on port 2200.
    ==> default: Clearing any previously set network interfaces...
    ==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
    ==> default: Forwarding ports...
    default: 22 => 2200 (adapter 1)
    ==> default: Running 'pre-boot' VM customizations...
    ==> default: Booting VM...
    ==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2200
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    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: Machine booted and ready!
    ==> default: Registering box with vagrant-registration...
    default: Would you like to register the system now (default: yes)? [y|n]n
    ==> 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.
    ==> default: Configuring and enabling network interfaces...
    ==> default: Copying TLS certificates to C:/Users/naina/Downloads/TestingBuilds/cdk/components/rhel/misc/rhel-k8s-singlenode-setup/.vagrant/machines/default/virtualbox/docker
    ==> default: Rsyncing folder: /cygdrive/c/Users/naina/Downloads/TestingBuilds/cdk/components/rhel/misc/rhel-k8s-singlenode-setup/ => /vagrant
    ==> default: Running provisioner: shell...
    default: Running: inline script

`

Vagrant registration output needs to be filtered in case of blank password on Fedora 23

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

Shouldn't try to register CentOS Atomic Host

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

RFE - support for --activationkey

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'

force registration

aka reregistration. In some situations it would be helpful to force a registration of a VM.

On RHEL 6.7 subscription-manager is located at /usr/sbin/subscription-manager

$ 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

User should have more than one try to fill username and password

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:

  1. allow for example 3 attempts to fill credentials
  2. give a hint how to do it manually after "vagrant ssh"

Apply locale based messaging

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.

RFE: Add support for importing CA certificate (needed to register against Katello/Satellite6)

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' ?

vagrant-registration does not work in conjunction with the vagrant-vbguest plugin

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.

Password echo to console under Cygwin MinTTY.(Windows)

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.

Add "pool" support

It would be nice to add a "pool" parameter to attach to a specific pool.

Multiple machines require multiple creds

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.

Add register and unregister commands

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`.

incomplete tips for configutration in readme

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

Getting Started

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.

Credentials specified via subscriber_username and subscriber_password are silently ignored

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.

The prompt does not have clarity about which password the user should use for registration.

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: 

Unregister only when destroy

Wouldn't be useful a flag that doesn't unregister the environment when you halt it, but only when you destroy it?

Subscription fails with 'Server Status: Not Subscribed'

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.

rhn_register upload certificate fails

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'

`vagrant destroy` not triggering subscription deactivation and removal

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):

  • VMware Fusion 8.1.0 (3272237)
  • Test Kitchen 1.4.2
  • Vagrant 1.8.1
  • vagrant-registration 1.1.0
  • vagrant-vmware-fusion 4.0.3 (though the problem occurs with the VirtualBox provider, too)
  • Official Red Hat Vagrant box beta 3 for VMware Fusion from Container Development Kit 2

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!

Use registration plugin in Oh-My-Vagrant

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 with invalid/unsubscribed subscription username/password and kubernates,openshift is in stopped state

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

Support proxies

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 :(

vagrant crash without credentials in variables

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:inmethod_missing'
from /home/optak/.vagrant.d/Vagrantfile:2:in block in <top (required)>' from /usr/share/vagrant/lib/vagrant/config/v2/loader.rb:37:incall'
from /usr/share/vagrant/lib/vagrant/config/v2/loader.rb:37:in load' from /usr/share/vagrant/lib/vagrant/config/loader.rb:103:inblock (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:inblock in load'
from /usr/share/vagrant/lib/vagrant/config/loader.rb:94:in each' from /usr/share/vagrant/lib/vagrant/config/loader.rb:94:inload'
from /usr/share/vagrant/lib/vagrant/vagrantfile.rb:28:in initialize' from /usr/share/vagrant/lib/vagrant/environment.rb:691:innew'
from /usr/share/vagrant/lib/vagrant/environment.rb:691:in vagrantfile' from /usr/share/vagrant/lib/vagrant/environment.rb:441:inhost'
from /usr/share/vagrant/lib/vagrant/environment.rb:207:in block in action_runner' from /usr/share/vagrant/lib/vagrant/action/runner.rb:33:incall'
from /usr/share/vagrant/lib/vagrant/action/runner.rb:33:in run' from /usr/share/vagrant/lib/vagrant/environment.rb:428:inhook'
from /usr/share/vagrant/lib/vagrant/environment.rb:673:in unload' from /usr/share/vagrant/bin/vagrant:177:inensure in

'
from /usr/share/vagrant/bin/vagrant:177:in `'

Plugin isn't ran while using OpenStack as the provider

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:inwaiting_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...

subscription-manager requires privilege escalation

* 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

No registration happens on vagrant up after host reboot

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.