diff --git a/cookbooks/aws-parallelcluster-platform/resources/enroot/partial/_enroot_common.rb b/cookbooks/aws-parallelcluster-platform/resources/enroot/partial/_enroot_common.rb index 485853639..d9c104fea 100644 --- a/cookbooks/aws-parallelcluster-platform/resources/enroot/partial/_enroot_common.rb +++ b/cookbooks/aws-parallelcluster-platform/resources/enroot/partial/_enroot_common.rb @@ -25,10 +25,12 @@ code <<-ENROOT_CONFIGURE set -e ENROOT_CONFIG_RELEASE=pyxis + SHARED_DIR=#{node['cluster']['shared_dir']} + NONROOT_USER=#{node['cluster']['cluster_user']} wget -O /tmp/enroot.template.conf https://raw.githubusercontent.com/aws-samples/aws-parallelcluster-post-install-scripts/${ENROOT_CONFIG_RELEASE}/pyxis/enroot.template.conf - mkdir -p #{node['cluster']['shared_dir']}/enroot - chown #{node['cluster']['cluster_user']} #{node['cluster']['shared_dir']}/enroot - ENROOT_CACHE_PATH=#{node['cluster']['shared_dir']}/enroot envsubst < /tmp/enroot.template.conf > /tmp/enroot.conf + mkdir -p ${SHARED_DIR}/enroot + chown ${NONROOT_USER} ${SHARED_DIR}/enroot + ENROOT_CACHE_PATH=${SHARED_DIR}/enroot envsubst < /tmp/enroot.template.conf > /tmp/enroot.conf mv /tmp/enroot.conf /etc/enroot/enroot.conf chmod 0644 /etc/enroot/enroot.conf @@ -37,7 +39,13 @@ mkdir -p /tmp/enroot/data chmod 1777 /tmp/enroot/data - chmod 1777 #{node['cluster']['shared_dir']}/enroot + chmod 1777 ${SHARED_DIR}/enroot + + mkdir -p ${SHARED_DIR}/pyxis/ + chown ${NONROOT_USER} ${SHARED_DIR}/pyxis/ + sed -i '${s/$/ runtime_path=${SHARED_DIR}\\/pyxis/}' /opt/slurm/etc/plugstack.conf.d/pyxis.conf + SHARED_DIR=${SHARED_DIR} envsubst < /opt/slurm/etc/plugstack.conf.d/pyxis.conf > /opt/slurm/etc/plugstack.conf.d/pyxis.tmp.conf + mv /opt/slurm/etc/plugstack.conf.d/pyxis.tmp.conf /opt/slurm/etc/plugstack.conf.d/pyxis.conf ENROOT_CONFIGURE retries 3 diff --git a/cookbooks/aws-parallelcluster-slurm/recipes/install/install_pyxis.rb b/cookbooks/aws-parallelcluster-slurm/recipes/install/install_pyxis.rb index 040d9ea02..548a4142d 100644 --- a/cookbooks/aws-parallelcluster-slurm/recipes/install/install_pyxis.rb +++ b/cookbooks/aws-parallelcluster-slurm/recipes/install/install_pyxis.rb @@ -39,14 +39,6 @@ echo -e 'include /opt/slurm/etc/plugstack.conf.d/*' | tee /opt/slurm/etc/plugstack.conf ln -fs /usr/local/share/pyxis/pyxis.conf /opt/slurm/etc/plugstack.conf.d/pyxis.conf - SHARED_DIR=#{node['cluster']['shared_dir']} - NONROOT_USER=#{node['cluster']['cluster_user']} - mkdir -p ${SHARED_DIR}/pyxis/ - chown ${NONROOT_USER} ${SHARED_DIR}/pyxis/ - sed -i '${s/$/ runtime_path=${SHARED_DIR}\\/pyxis/}' /opt/slurm/etc/plugstack.conf.d/pyxis.conf - SHARED_DIR=${SHARED_DIR} envsubst < /opt/slurm/etc/plugstack.conf.d/pyxis.conf > /opt/slurm/etc/plugstack.conf.d/pyxis.tmp.conf - mv /opt/slurm/etc/plugstack.conf.d/pyxis.tmp.conf /opt/slurm/etc/plugstack.conf.d/pyxis.conf - PYXIS_INSTALL retries 3 retry_delay 5