From 4d6a136a64d71fd83fda176a159f5ee53767325b Mon Sep 17 00:00:00 2001 From: Ryan Hass Date: Fri, 16 Mar 2018 16:05:16 -0700 Subject: [PATCH] Set HOME environment variable on initial startup. `automate-ctl create-enterprise` is called via the marketplace gem and chef-marketplace-ctl. We execute the chef-marketplace-ctl commands automatically on first boot with the `--preconfigure` flag to configure the Chef Automate and Chef Server products, as well as allow users to configure their credentials via the biscotti interface. The `chef-marketplace-ctl` command calls `automate-ctl`, which calls an escript `enterprise_ctl` which requires the environment variable `HOME` to be defined as a valid path. This ensures we set a value and allows the enterprise to be created. Fixes SUSTAIN-844 #comment Set $HOME environment variable to prevent `delivery-ctl create-enterprise default` from failing. Signed-off-by: Ryan Hass --- arm-templates/automate/automate_setup.rb | 8 ++++++-- cloudformation/marketplace_byol.yml | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arm-templates/automate/automate_setup.rb b/arm-templates/automate/automate_setup.rb index 7619b5a..36eab04 100644 --- a/arm-templates/automate/automate_setup.rb +++ b/arm-templates/automate/automate_setup.rb @@ -32,10 +32,14 @@ config.puts(%Q{api_fqdn "#{@fqdn}"}) end +environment = { + 'HOME' => '/root' +} + # Configure the hostname -hostname = Mixlib::ShellOut.new("chef-marketplace-ctl hostname #{@fqdn}") +hostname = Mixlib::ShellOut.new("chef-marketplace-ctl hostname #{@fqdn}", env: environment) hostname.run_command # Configure Automate -configure = Mixlib::ShellOut.new("chef-marketplace-ctl setup --preconfigure") +configure = Mixlib::ShellOut.new("chef-marketplace-ctl setup --preconfigure", env: environment) configure.run_command diff --git a/cloudformation/marketplace_byol.yml b/cloudformation/marketplace_byol.yml index d971ea3..be80214 100644 --- a/cloudformation/marketplace_byol.yml +++ b/cloudformation/marketplace_byol.yml @@ -253,6 +253,7 @@ Resources: - |+ - - '#!/bin/bash -ex' + - export HOME=/root - !If - HasLicenseUrl - !Sub >-