Jira (BOLT-1478) Scripts without explicit interpreters don't work

3 views
Skip to first unread message

Dylan Ratcliffe (JIRA)

unread,
Jul 23, 2019, 3:51:04 AM7/23/19
to puppe...@googlegroups.com
Dylan Ratcliffe created an issue
 
Puppet Task Runner / Bug BOLT-1478
Scripts without explicit interpreters don't work
Issue Type: Bug Bug
Affects Versions: BOLT 1.26.0
Assignee: Unassigned
Created: 2019/07/23 12:50 AM
Environment:

Here is the full debug output of the commands that I ran:

Running the task over winrm:

 bolt task run python --nodes winstudents -i inventory.yaml --debug --modulepath .                                                                                                    
Ignoring byebug-10.0.2 because its extensions are not built. Try: gem pristine byebug --version 10.0.2
Loaded inventory from /Users/dylan/pxp-test/inventory.yaml
Ignoring byebug-10.0.2 because its extensions are not built. Try: gem pristine byebug --version 10.0.2
Submitting analytics: {
  "v": 1,
  "cid": "cd6ff8b7-57ce-46f8-9394-07e32b28c7f5",
  "tid": "UA-120367942-1",
  "an": "bolt",
  "av": "1.26.0",
  "aip": true,
  "ul": "en-AU",
  "cd1": "Darwin 18",
  "t": "screenview",
  "cd": "task_run",
  "cd5": "human",
  "cd4": 1,
  "cd2": 8,
  "cd3": 7
}
Loading modules from /opt/puppetlabs/bolt/lib/ruby/gems/2.5.0/gems/bolt-1.26.0/bolt-modules:/Users/dylan/pxp-test:/opt/puppetlabs/bolt/lib/ruby/gems/2.5.0/gems/bolt-1.26.0/modules
Started with 100 max thread(s)
Completed analytics submission
Starting: task python on 3.8.187.183
Submitting analytics: {
  "v": 1,
  "cid": "cd6ff8b7-57ce-46f8-9394-07e32b28c7f5",
  "tid": "UA-120367942-1",
  "an": "bolt",
  "av": "1.26.0",
  "aip": true,
  "ul": "en-AU",
  "cd1": "Darwin 18",
  "t": "event",
  "ec": "Transport",
  "ea": "initialize",
  "el": "winrm",
  "ev": 1
}
Running task python with '{"_task"=>"python"}' on ["3.8.187.183"]
Running task run '#<struct Bolt::Task name="python", file=nil, files=[{"name"=>"init.py", "path"=>"/Users/dylan/pxp-test/python/tasks/init.py"}], metadata={"description"=>"does a python thing"}>' on 3.8.187.183
Started on 3.8.187.183...
Completed analytics submission
Opened session
Executing command: $parent = [System.IO.Path]::GetTempPath()
$name = [System.IO.Path]::GetRandomFileName()
$path = Join-Path $parent $name
New-Item -ItemType Directory -Path $path | Out-Null
$pathstdout: C:\Users\Administrator\AppData\Local\Temp\jiigl2jc.uw3stderr:
Command returned successfully
Executing command: Remove-Item -Force -Recurse -Path "C:\Users\Administrator\AppData\Local\Temp\jiigl2jc.uw3"Command returned successfully
Closed session
{"node":"3.8.187.183","target":"3.8.187.183","action":null,"object":null,"status":"failure","result":{"_error":{"kind":"puppetlabs.tasks/task_file_error","msg":"File extension .py is not enabled, to run it please add to 'winrm: extensions'","details":{},"issue_code":"FILETYPE_ERROR"}}}
Failed on 3.8.187.183:
  File extension .py is not enabled, to run it please add to 'winrm: extensions'
Finished: task python with 1 failure in 1.12 sec
Failed on 1 node: 3.8.187.183
Ran on 1 node in 1.21 seconds 

Running the command:

 bolt command run "cmd.exe /c C:\ProgramData\PuppetLabs\pxp-agent\tasks-cache\e377cfba7d31e263cca6a946714b0e0904219892b95b72ebe60bd14e297e376b\init.py" --nodes winstudents -i inventory.yaml --debug
Ignoring byebug-10.0.2 because its extensions are not built. Try: gem pristine byebug --version 10.0.2
Loaded inventory from /Users/dylan/pxp-test/inventory.yaml
Submitting analytics: {
  "v": 1,
  "cid": "cd6ff8b7-57ce-46f8-9394-07e32b28c7f5",
  "tid": "UA-120367942-1",
  "an": "bolt",
  "av": "1.26.0",
  "aip": true,
  "ul": "en-AU",
  "cd1": "Darwin 18",
  "t": "screenview",
  "cd": "command_run",
  "cd5": "human",
  "cd4": 1,
  "cd2": 8,
  "cd3": 7
}
Started with 100 max thread(s)
Starting: command 'cmd.exe /c C:\ProgramData\PuppetLabs\pxp-agent\tasks-cache\e377cfba7d31e263cca6a946714b0e0904219892b95b72ebe60bd14e297e376b\init.py' on 3.8.187.183
Completed analytics submission
Submitting analytics: {
  "v": 1,
  "cid": "cd6ff8b7-57ce-46f8-9394-07e32b28c7f5",
  "tid": "UA-120367942-1",
  "an": "bolt",
  "av": "1.26.0",
  "aip": true,
  "ul": "en-AU",
  "cd1": "Darwin 18",
  "t": "event",
  "ec": "Transport",
  "ea": "initialize",
  "el": "winrm",
  "ev": 1
}
Running command 'cmd.exe /c C:\ProgramData\PuppetLabs\pxp-agent\tasks-cache\e377cfba7d31e263cca6a946714b0e0904219892b95b72ebe60bd14e297e376b\init.py' on ["3.8.187.183"]
Running command 'cmd.exe /c C:\ProgramData\PuppetLabs\pxp-agent\tasks-cache\e377cfba7d31e263cca6a946714b0e0904219892b95b72ebe60bd14e297e376b\init.py' on 3.8.187.183
Started on 3.8.187.183...
Completed analytics submission
Opened session
Executing command: cmd.exe /c C:\ProgramData\PuppetLabs\pxp-agent\tasks-cache\e377cfba7d31e263cca6a946714b0e0904219892b95b72ebe60bd14e297e376b\init.py
stdout: Goodbye, World!stderr:
Command returned successfully
Closed session
{"node":"3.8.187.183","target":"3.8.187.183","action":"command","object":"cmd.exe /c C:\\ProgramData\\PuppetLabs\\pxp-agent\\tasks-cache\\e377cfba7d31e263cca6a946714b0e0904219892b95b72ebe60bd14e297e376b\\init.py","status":"success","result":{"stdout":"Goodbye, World!\r\n","stderr":"","exit_code":0}}
Finished on 3.8.187.183:
  STDOUT:
    Goodbye, World!
Finished: command 'cmd.exe /c C:\ProgramData\PuppetLabs\pxp-agent\tasks-cache\e377cfba7d31e263cca6a946714b0e0904219892b95b72ebe60bd14e297e376b\init.py' with 0 failures in 1.11 sec
Successful on 1 node: 3.8.187.183
Ran on 1 node in 1.11 seconds 

Running the script:

  bolt script run python/tasks/init.py --nodes winstudents -i inventory.yaml --debug --modulepath .                                                                                   
Ignoring byebug-10.0.2 because its extensions are not built. Try: gem pristine byebug --version 10.0.2
Loaded inventory from /Users/dylan/pxp-test/inventory.yaml
Submitting analytics: {
  "v": 1,
  "cid": "cd6ff8b7-57ce-46f8-9394-07e32b28c7f5",
  "tid": "UA-120367942-1",
  "an": "bolt",
  "av": "1.26.0",
  "aip": true,
  "ul": "en-AU",
  "cd1": "Darwin 18",
  "t": "screenview",
  "cd": "script_run",
  "cd5": "human",
  "cd4": 1,
  "cd2": 8,
  "cd3": 7
}
Started with 100 max thread(s)
Starting: script python/tasks/init.py on 3.8.187.183
Completed analytics submission
Submitting analytics: {
  "v": 1,
  "cid": "cd6ff8b7-57ce-46f8-9394-07e32b28c7f5",
  "tid": "UA-120367942-1",
  "an": "bolt",
  "av": "1.26.0",
  "aip": true,
  "ul": "en-AU",
  "cd1": "Darwin 18",
  "t": "event",
  "ec": "Transport",
  "ea": "initialize",
  "el": "winrm",
  "ev": 1
}
Running script python/tasks/init.py with '[]' on ["3.8.187.183"]
Running script 'python/tasks/init.py' on 3.8.187.183
Started on 3.8.187.183...
Completed analytics submission
Opened session
Executing command: $parent = [System.IO.Path]::GetTempPath()
$name = [System.IO.Path]::GetRandomFileName()
$path = Join-Path $parent $name
New-Item -ItemType Directory -Path $path | Out-Null
$pathstdout: C:\Users\Administrator\AppData\Local\Temp\m53mfj2y.kjestderr:
Command returned successfully
Executing command: Remove-Item -Force -Recurse -Path "C:\Users\Administrator\AppData\Local\Temp\m53mfj2y.kje"Command returned successfully
Closed session
Failed on 3.8.187.183:
{"node":"3.8.187.183","target":"3.8.187.183","action":null,"object":null,"status":"failure","result":{"_error":{"kind":"puppetlabs.tasks/task_file_error","msg":"File extension .py is not enabled, to run it please add to 'winrm: extensions'","details":{},"issue_code":"FILETYPE_ERROR"}}}
  File extension .py is not enabled, to run it please add to 'winrm: extensions'
Finished: script python/tasks/init.py with 1 failure in 2.08 sec
Failed on 1 node: 3.8.187.183
Ran on 1 node in 2.08 seconds 

Priority: Normal Normal
Reporter: Dylan Ratcliffe

When running a task written in say; python, I would expect it to work if I have the python interpreter installed as normal on my system without specifying the interpreter as per the config docs: https://puppet.com/docs/bolt/latest/bolt_configuration_options.html#sample-bolt-configuration-file

I have the following very basic task written in python:

print("Goodbye, World!") 

With the following metadata:

{
  "description": "does a python thing"
} 

When I run the task over PXP I get a 127 error as per PCP-879, but when I use bolt I get the following error:

File extension .py is not enabled, to run it please add to 'winrm: extensions' 

However the interpreters are set up correctly on the system as copying the file to the system and running the following command works:

bolt command run "cmd.exe /c C:\ProgramData\PuppetLabs\pxp-agent\tasks-cache\e377cfba7d31e263cca6a946714b0e0904219892b95b72ebe60bd14e297e376b\init.py" --nodes winstudents -i inventory.yaml --debug 

 

It appears that if the file doesn't have a known interpreter Bolt doesn't even try to execute it which surely is undesired behaviour.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Dylan Ratcliffe (JIRA)

unread,
Jul 23, 2019, 3:52:02 AM7/23/19
to puppe...@googlegroups.com
Dylan Ratcliffe updated an issue
Change By: Dylan Ratcliffe
When running a task written in say; python, I would expect it to work if I have the python interpreter installed as normal on my system without specifying the interpreter as per the config docs: [https://puppet.com/docs/bolt/latest/bolt_configuration_options.html#sample-bolt-configuration-file]

I have the following very basic task written in python:
{code:java}
print("Goodbye, World!") {code}
With the following metadata:
{code:java}

{
  "description": "does a python thing"
} {code}

When I run the task over PXP I get a 127 error as per PCP-879, but when I use bolt I get the following error:
{code:java}
File extension .py is not enabled, to run it please add to 'winrm: extensions' {code}

However the interpreters are set up correctly on the system as copying the file to the system and running the following command works:
{code:java}
bolt command run "cmd.exe /c C:\ProgramData\PuppetLabs\pxp-agent\tasks-cache\e377cfba7d31e263cca6a946714b0e0904219892b95b72ebe60bd14e297e376b\init.py" --nodes winstudents -i inventory.yaml --debug {code}

 

It appears that if the file doesn't have a known interpreter Bolt doesn't even try to execute it which surely is undesired behaviour.


 

Full debug output can be found in the "Environment" section

Alex Dreyer (JIRA)

unread,
Aug 19, 2019, 6:50:04 PM8/19/19
to puppe...@googlegroups.com
Alex Dreyer commented on Bug BOLT-1478
 
Re: Scripts without explicit interpreters don't work

Not executing files by default on windows is intentional based on feedback from the windows team it was decided that known handlers are often set up for GUI interactions and should not be just run.

Reply all
Reply to author
Forward
0 new messages