diff --git a/cookbooks/aws-parallelcluster-environment/recipes/config/config_cfn_hup.rb b/cookbooks/aws-parallelcluster-environment/recipes/config/config_cfn_hup.rb index 7a82d5777..71e881e92 100644 --- a/cookbooks/aws-parallelcluster-environment/recipes/config/config_cfn_hup.rb +++ b/cookbooks/aws-parallelcluster-environment/recipes/config/config_cfn_hup.rb @@ -56,6 +56,7 @@ region: node['cluster']['region'], cloudformation_url: cloudformation_url, cfn_init_role: instance_role_name, - launch_template_resource_id: node['cluster']['launch_template_id'] + launch_template_resource_id: node['cluster']['launch_template_id'], + cfn_bootstrap_virtualenv_path: cookbook_virtualenv_path ) end diff --git a/cookbooks/aws-parallelcluster-environment/spec/unit/recipes/config_cfn_hup_spec.rb b/cookbooks/aws-parallelcluster-environment/spec/unit/recipes/config_cfn_hup_spec.rb index 0e3c372a5..6c843103b 100644 --- a/cookbooks/aws-parallelcluster-environment/spec/unit/recipes/config_cfn_hup_spec.rb +++ b/cookbooks/aws-parallelcluster-environment/spec/unit/recipes/config_cfn_hup_spec.rb @@ -20,6 +20,7 @@ CLOUDFORMATION_URL = "https://cloudformation.#{AWS_REGION}.#{AWS_DOMAIN}" INSTANCE_ROLE_NAME = "INSTANCE_ROLE_NAME" LAUNCH_TEMPLATE_ID = "LAUNCH_TEMPLATE_ID" + CFN_BOOTSTRAP_VIRTUALENV_PATH = "CFN_BOOTSTRAP_VIRTUALENV_PATH" for_all_oses do |platform, version| context "on #{platform}#{version}" do @@ -81,6 +82,7 @@ cloudformation_url: CLOUDFORMATION_URL, cfn_init_role: INSTANCE_ROLE_NAME, launch_template_resource_id: LAUNCH_TEMPLATE_ID, + cfn_bootstrap_virtualenv_path: CFN_BOOTSTRAP_VIRTUALENV_PATH, }) end end diff --git a/cookbooks/aws-parallelcluster-environment/templates/cfn_bootstrap/cfn-hook-update.conf.erb b/cookbooks/aws-parallelcluster-environment/templates/cfn_bootstrap/cfn-hook-update.conf.erb index 11abdf651..0a3cc3cc7 100644 --- a/cookbooks/aws-parallelcluster-environment/templates/cfn_bootstrap/cfn-hook-update.conf.erb +++ b/cookbooks/aws-parallelcluster-environment/templates/cfn_bootstrap/cfn-hook-update.conf.erb @@ -1,5 +1,5 @@ [parallelcluster-update] triggers=post.update path=Resources.<%= @launch_template_resource_id %>.Metadata.AWS::CloudFormation::Init -action=PATH=/usr/local/bin:/bin:/usr/bin:/opt/aws/bin; . /etc/profile.d/pcluster_cookbook_environment.sh; $CFN_BOOTSTRAP_VIRTUALENV_PATH/cfn-init -v --stack <%= @stack_id %> --resource <%= @launch_template_resource_id %> --configsets update --region <%= @region %> --url <%= @cloudformation_url %> --role <%= @cfn_init_role %> +action=PATH=/usr/local/bin:/bin:/usr/bin:/opt/aws/bin; . /etc/profile.d/pcluster_cookbook_environment.sh; <%= @cfn_bootstrap_virtualenv_path %>/bin/cfn-init -v --stack <%= @stack_id %> --resource <%= @launch_template_resource_id %> --configsets update --region <%= @region %> --url <%= @cloudformation_url %> --role <%= @cfn_init_role %> runas=root