From f4e6a855c53eaa2a84206025ead537025b6c5537 Mon Sep 17 00:00:00 2001 From: VimukthiPerera Date: Tue, 9 Oct 2018 17:04:42 +0530 Subject: [PATCH] Add support for both GA and updated packs --- README.md | 8 ++++++-- Vagrantfile | 26 ++++++++++++++++---------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index bfab90a..25d1892 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ In order to use Vagrant boxes, you will need an active subscription from WSO2 since the Vagrant boxes hosted at vagrant.wso2.com contains the latest updates and fixes to WSO2 Identity Server. You can sign up for a Free Trial Subscription [here](https://wso2.com/free-trial-subscription). -If you wish to use the Vagrant boxes without updates, please build them from [here](https://github.com/wso2/vagrant-boxes). - This section defines the procedure to execute Vagrant resources for a setup of WSO2 Identity Server single node with Analytics support.
@@ -32,9 +30,15 @@ cd vagrant-is 3. Spawn up the Vagrant setup. +``` +vagrant --updates up +``` +If you wish to use the Vagrant boxes without updates, spawn up the Vagrant setup. + ``` vagrant up ``` + 4. Access the Identity Server and Identity Server Analytics via the URLs given below. ``` diff --git a/Vagrantfile b/Vagrantfile index 1715bf2..4311e4e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -21,22 +21,22 @@ require 'uri' require 'erb' # check whether the command is 'vagrant up' -if ARGV[0] == 'up' +if ARGV[0] == '--updates' print "Please insert your WSO2 credentials\n" print "Username: " USERNAME = STDIN.gets.chomp print "Password: " PASSWORD = STDIN.noecho(&:gets).chomp print "\n" + # generate TOKEN + TOKEN = [ERB::Util.url_encode(USERNAME), ERB::Util.url_encode(PASSWORD)].join(':') else # initializing USERNAME and PASSWORD + print "Using the Vagrant boxes with no updates...\n" USERNAME = "" PASSWORD = "" end -# generate TOKEN -TOKEN = [ERB::Util.url_encode(USERNAME), ERB::Util.url_encode(PASSWORD)].join(':') - FILES_PATH = "./" DEFAULT_MOUNT = "/home/vagrant/" # load server configurations from YAML file @@ -51,17 +51,23 @@ Vagrant.configure(2) do |config| # define the virtual machine configurations config.vm.define server['hostname'] do |server_config| # define the base Vagrant box to be used - server_config.vm.box = server['box'] + if ARGV[0] == '--updates' + server_config.vm.box = server['box'] + else + server_config.vm.box = "wso2/" + server['box'] + end + # define the virtual machine host name server_config.vm.host_name = server['hostname'] - - server_config.vm.box_check_update = true - # Diasbling the synched folder server_config.vm.synced_folder ".", "/vagrant", disabled: true - #generate the url - url = "https://"+TOKEN+"@vagrant.wso2.com/boxes/"+server['box']+".box" + if ARGV[0] == '--updates' + #generate the url + url = "https://"+TOKEN+"@vagrant.wso2.com/boxes/" + server['box'] + ".box" + else + url = "https://vagrantcloud.com/wso2/" + server['box'] + end server_config.vm.box_url = url