Bug 1302830 - For JBDS integration, CDK Vagrantfiles needs to setup use of env variables for registration plugin
Summary: For JBDS integration, CDK Vagrantfiles needs to setup use of env variables fo...
Keywords:
Status: ASSIGNED
Alias: None
Product: Container Development Kit (CDK)
Classification: Red Hat
Component: distribution
Version: 2.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: beta4
: 2.0
Assignee: Lalatendu Mohanty
QA Contact: David Kutálek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-28 18:10 UTC by David Kutálek
Modified: 2024-02-05 16:57 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.