github.com/hashicorp/packer@v1.14.3/provisioner/powershell/test-fixtures/powershell-exit_codes-provisioner.txt (about)

     1  {
     2    "type": "powershell",
     3    "inline": ["invalid-cmdlet"],
     4    "valid_exit_codes": ["1"]
     5  },
     6  {
     7    "type": "powershell",
     8    "inline": ["#Requires -Version 10.0"],
     9    "valid_exit_codes": ["1"]
    10  },
    11  {
    12    "type": "powershell",
    13    "inline": ["exit 1"],
    14    "valid_exit_codes": ["1"]
    15  },
    16  {
    17    "type": "powershell",
    18    "inline": ["}}"],
    19    "valid_exit_codes": ["1"]
    20  },
    21  {
    22    "type": "powershell",
    23    "inline": ["$LASTEXITCODE=1"],
    24    "valid_exit_codes": ["1"]
    25  },
    26  {
    27    "type": "powershell",
    28    "inline": ["throw 'XXX'"],
    29    "valid_exit_codes": ["1"]
    30  },
    31  {
    32    "type": "powershell",
    33    "script": "../../provisioner/powershell/test-fixtures/scripts/set_version_latest.ps1",
    34    "valid_exit_codes": ["0"]
    35  },
    36  {
    37    "type": "powershell",
    38    "elevated_user": "Administrator",
    39    "elevated_password": "{{.WinRMPassword}}",
    40    "inline": "Get-ItemProperty -Path HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
    41    "valid_exit_codes": ["0"]
    42  },
    43  {
    44    "type": "powershell",
    45    "inline": "ping invalidhost",
    46    "valid_exit_codes": ["1"]
    47  },
    48  {
    49    "type": "powershell",
    50    "inline": "sc.exe start command",
    51    "valid_exit_codes": ["1060"]
    52  },
    53  {
    54    "type": "powershell",
    55    "inline": "echo 'Hi testing echo'; invalid command!; echo 'Another valid command';",
    56    "valid_exit_codes": ["1"]
    57  },
    58  {
    59    "type": "powershell",
    60    "inline": ["$ErrorActionPreference='Stop'", "Get-Item 'C:\\nonexistent.txt'"],
    61    "valid_exit_codes": ["1"]
    62  },
    63  {
    64    "type": "powershell",
    65    "inline": [    
    66                  "try {",
    67                  " invalid command",
    68                  "} catch {",
    69                  "    exit 1",
    70                  "}"
    71              ],
    72    "valid_exit_codes": ["1"]
    73  }
    74  
    75  
    76