|
74 | 74 | end |
75 | 75 | end |
76 | 76 |
|
| 77 | +if alinux2023_on_docker? |
| 78 | + # Create pcluster-admin user and group |
| 79 | + group 'pcluster-admin' do |
| 80 | + gid 400 |
| 81 | + end |
| 82 | + |
| 83 | + user 'pcluster-admin' do |
| 84 | + uid 400 |
| 85 | + gid 400 |
| 86 | + home '/home/pcluster-admin' |
| 87 | + shell '/bin/bash' |
| 88 | + end |
| 89 | + |
| 90 | + # Create required directories |
| 91 | + directory '/opt/parallelcluster/shared' do |
| 92 | + recursive true |
| 93 | + end |
| 94 | + |
| 95 | + # Install Python 3.12 for AL2023 Docker tests |
| 96 | + package 'python3.12' |
| 97 | + package 'python3.12-pip' |
| 98 | + |
| 99 | + # Mock python environment for AL2023 Docker tests |
| 100 | + # The pyenv/virtualenv setup doesn't work in Docker because it requires S3 access |
| 101 | + python_version = node['cluster']['python-version'] |
| 102 | + pyenv_root = node['cluster']['system_pyenv_root'] |
| 103 | + virtualenv_path = "#{pyenv_root}/versions/#{python_version}/envs/cookbook_virtualenv" |
| 104 | + |
| 105 | + directory "#{virtualenv_path}/bin" do |
| 106 | + recursive true |
| 107 | + end |
| 108 | + |
| 109 | + # Create a wrapper script that reports the expected version but uses system Python |
| 110 | + file "#{virtualenv_path}/bin/python" do |
| 111 | + content %(#!/bin/bash |
| 112 | +if [[ "$1" == "-V" || "$1" == "--version" ]]; then |
| 113 | + echo "Python #{python_version}" |
| 114 | +else |
| 115 | + exec /usr/bin/python3.12 "$@" |
| 116 | +fi |
| 117 | +) |
| 118 | + mode '0755' |
| 119 | + end |
| 120 | + |
| 121 | + link "#{virtualenv_path}/bin/pip" do |
| 122 | + to '/usr/bin/pip3.12' |
| 123 | + end |
| 124 | + |
| 125 | + bash 'Install cookbook requirements for AL2023' do |
| 126 | + cwd Chef::Config[:file_cache_path] |
| 127 | + code "/usr/bin/python3.12 -m pip install -r cookbooks/aws-parallelcluster-platform/files/cookbook_virtualenv/requirements.txt" |
| 128 | + end |
| 129 | +end |
| 130 | + |
77 | 131 | file '/usr/bin/ssh-keyscan' do |
78 | 132 | content %( |
79 | 133 | #!/bin/bash |
|
0 commit comments