packer-plugin-azure icon indicating copy to clipboard operation
packer-plugin-azure copied to clipboard

Randomly generated SSH Password not set unless communicator type is explicitly set to ssh

Open shubhang93 opened this issue 9 months ago • 3 comments

When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.

Overview of the Issue

The build variable Password returns an empty string if it's not explicitly set using the ssh_password option. When ssh_password is set it works fine.

Reproduction Steps

Steps to reproduce this issue

Plugin and Packer version

packer: v1.10.0 Plugin: v2.1.3

From packer version

Simplified Packer Buildfile

If the file is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.

build {
  sources = [
    "..."
  ]

  provisioner "shell" {
        script = "scripts/setup.sh"
	execute_command =  "chmod +x {{ .Path }}; {{ .Vars }}  bash -x -l '{{ .Path }}'"
	environment_vars = [
        "ROOT_PSSWD=${build.Password}",
	"USER_ID=${build.User}",
	"BUILD_ID=${build.ID}",
    ]
  }
}

setup.sh

echo "PASSWORD = ${ROOT_PSSWD}"

output

PASSWORD=<empty_string>

Operating system and Environment details

OS, Architecture, and any other information you can provide about the environment.

Log Fragments and crash.log files

 azure-arm...: temp admin user: 'user'
 azure-arm... temp admin password: '22wlrlNpqTPw6yrDKwwUaxdtL9eta34q'

Set the env var PACKER_LOG=1 for maximum log detail.

Remote command exited with '1': chmod +x /tmp/script_7867.sh; BUILD_ID='ERR_ID_NOT_IMPLEMENTED_BY_BUILDER' C_FORCE_ROOT='True'  
ROOT_PSSWD='' bash -x -l '/tmp/script_7867.sh'

shubhang93 avatar May 15 '24 09:05 shubhang93