Bug 1302830

Summary: For JBDS integration, CDK Vagrantfiles needs to setup use of env variables for registration plugin
Product: Container Development Kit (CDK) Reporter: David Kutálek <dkutalek>
Component: distributionAssignee: Lalatendu Mohanty <lmohanty>
Status: ASSIGNED --- QA Contact: David Kutálek <dkutalek>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 2.0CC: bgollahe, jgreguske, lmohanty, mmalina, optak, prkumar
Target Milestone: beta4   
Target Release: 2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Kutálek 2016-01-28 18:10:56 UTC
Description of problem:

JBDS (eclipse) calls cdk vagrant in background without TTY,
it needs to pass username/password via env variables.

These needs to be added into cdk Vagrant files:

  config.registration.username = ENV['SUB_USERNAME']
  config.registration.password = ENV['SUB_PASSWORD']

I just tested that even with this setting, 
given that env variables are not set,
Vagrant will ask. This is important for non-JBDS use cases.

Version-Release number of selected component (if applicable):

beta4 cdk.zip

How reproducible:

Always

Steps to Reproduce:
1. Run vagrant up without tty, but with env variables mentioned above
2. Run vagrant up with tty but without variables
3.

Actual results:

1. does not work
2. does work (asks)

Expected results:

1. works without asking
2. works with asking

Comment 1 Ondřej Pták 2016-02-04 14:46:42 UTC
On windows, with registration plugin expecting credentials from environment variables, I got question only for password, not for username, it can be problem, need to investigate more.

Comment 3 Lalatendu Mohanty 2016-02-18 16:01:18 UTC
Added the env variables as requested.

Comment 5 Ondřej Pták 2016-02-25 08:14:51 UTC
This should be solved a little bit differently. In expected usage it works fine, but problem is if vagrant-registration is not installed.
Without registration plugin, config.registration doesn't exists, so vagrant commands fails with traceback.

Proposed solution for discussion:
1) encapsulate these command with check for plugin:
if Vagrant.has_plugin?('vagrant-registration')
  config.registration.username = ENV['SUB_USERNAME']
  config.registration.password = ENV['SUB_PASSWORD']
end

2) print some nice error if plugin is not installed:
# check if plugin is installed on system
unless Vagrant.has_plugin?("vagrant-registration")
  raise "vagrant-registration plugin is not installed, run `vagrant plugin install vagrant-registration` to install the plugin."
end