Created
May 7, 2019 06:56
-
-
Save ripienaar/cc28b4b2039107a8967f53faed0e0b66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/puppetlabs/puppet/bin/ruby | |
require "mcollective" | |
ddlfile = ARGV.shift | |
abort("Please specify an input DDL as argument") unless ddlfile | |
ddl = MCollective::DDL.new(File.basename(ddlfile, ".ddl"), :agent, false) | |
ddl.instance_eval(File.read(ddlfile)) | |
data = { | |
"$schema" => "https://choria.io/schemas/mcorpc/ddl/v1/agent.json", | |
"metadata" => ddl.meta, | |
"actions" => [], | |
} | |
ddl.actions.sort.each do |action| | |
data["actions"] << ddl.action_interface(action) | |
end | |
puts JSON.pretty_generate(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment