Hi Team,
I have a ruby task which calls a .ps1 file on puppet master. As a part of
calling the puppet file i need to define the file path in ruby task.
file_path = "/etc/puppetlabs/code/environments//modules//files/.ps1"
script_params = ""
# execution of the script
cmd_output =
Hi Lucy,
Thanks for the explanation. Yeah, we are trying to run the powershell
script on the puppet server through a ruby task.
script_path = "/etc/puppetlabs/code/environments/#{env_name}/modules//files/testfile.ps1"
script_params = ""
# Execute the script
cmd_output =
Hi!
You'll want to specify the .ps1 file as a 'file' in your task metadata, and
then can refer to it relative to the task itself as ../../file.ps1 from
your ruby task. This doc
(https://puppet.com/docs/pe/2019.8/writing_tasks.html#sharing_task_code)
Hi Lucy,
Thanks for your response.
I already tried and faced the below issue while loading the file.
`require_relative': cannot load such file --
/opt/puppetlabs/pxp-agent/spool/98/temp_task_5881-56e6-b035-6d66/files/testfile.ps1
Its pointing the different path than the expected one :
Right, I don't think you can "import" a powershell script into a ruby
script (at all, in any situation), but you can call the script directly
from the ruby script with something like:
$result = `powershell.exe ../../testfile.ps1`
Having the file in your environment is mostly useful for being able
The next release in the Puppet 6 series, Puppet 6.19.1, is now available!
This release has a fix for a regression introduced in 6.19.0.
- This fix addresses an issue where masterport was not honored when
configured in a section other than main. PUP-10722