Skip to content

Commit ca5503a

Browse files
committed
Switch read_file to ruby
Because `python` is not available out of the box on Ubuntu. They switched it to `python3`. On CentOS 8 that package is available, but not installed out of box. So ruby is most reliable now for this use case.
1 parent 134d748 commit ca5503a

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

tasks/read_file.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
"description": "Path to the file to read"
77
}
88
},
9-
"input_method": "environment"
9+
"input_method": "stdin",
10+
"implementations": [
11+
{"name": "read_file.rb"}
12+
]
1013
}

tasks/read_file.rb

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/opt/puppetlabs/puppet/bin/ruby
2+
3+
require 'json'
4+
5+
params = JSON.parse(STDIN.read)
6+
content = File.read(params['path'])
7+
result = { 'content' => content }.to_json
8+
9+
puts result

tasks/read_file.sh

-18
This file was deleted.

0 commit comments

Comments
 (0)