Skip to content

Commit

Permalink
(#87) update DDL files
Browse files Browse the repository at this point in the history
Signed-off-by: R.I.Pienaar <[email protected]>
  • Loading branch information
ripienaar committed Dec 28, 2020
1 parent 36c4e45 commit a067694
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 61 deletions.
32 changes: 32 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,35 @@ task :test do
sh "bundle exec rubocop --config .rubocop.yml lib"
sh "bundle exec rspec"
end

desc "Update JSON DDL files"
task :update_ddl do
require "mcollective"

Dir.glob("lib/mcollective/agent/*.ddl") do |ddlfile|
next if ddlfile =~ /^choria_uril/

agent_dir = File.dirname(ddlfile)
agent_name = File.basename(ddlfile, ".ddl")
json_file = File.join(agent_dir, "%s.json" % agent_name)

ddl = MCollective::DDL.new(agent_name, :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 "Writing JSON DDL in %s" % json_file

File.open(json_file, "w") do |jddl|
jddl.print(JSON.pretty_generate(data))
end
end
end
4 changes: 2 additions & 2 deletions lib/mcollective/agent/choria_util.ddl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata :name => "choria_util",
:license => "Apache-2.0",
:version => "0.19.0",
:url => "https://choria.io",
:timeout => 20
:timeout => 2

requires :mcollective => "2.9.0"

Expand Down Expand Up @@ -50,7 +50,7 @@ action "machine_transition", :description => "Attempts to force a transition in
:optional => false

output :success,
:description => "Indicates if the transition was succesfully accepted",
:description => "Indicates if the transition was successfully accepted",
:display_as => "Accepted"
end

Expand Down
4 changes: 2 additions & 2 deletions lib/mcollective/agent/choria_util.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "Apache-2.0",
"version": "0.19.0",
"url": "https://choria.io",
"timeout": 20
"timeout": 2
},
"actions": [
{
Expand Down Expand Up @@ -232,7 +232,7 @@
},
"output": {
"success": {
"description": "Indicates if the transition was succesfully accepted",
"description": "Indicates if the transition was successfully accepted",
"display_as": "Accepted",
"default": null
}
Expand Down
49 changes: 0 additions & 49 deletions lib/mcollective/agent/choria_util.rb

This file was deleted.

4 changes: 2 additions & 2 deletions lib/mcollective/agent/rpcutil.ddl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ metadata :name => "rpcutil",
:author => "R.I.Pienaar <[email protected]>",
:license => "Apache License, Version 2.0",
:version => "0.19.0",
:url => "https://docs.puppetlabs.com/mcollective/",
:timeout => 10
:url => "https://choria.io/",
:timeout => 2

action "collective_info", :description => "Info about the main and sub collectives" do
display :always
Expand Down
4 changes: 2 additions & 2 deletions lib/mcollective/agent/rpcutil.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"author": "R.I.Pienaar <[email protected]>",
"license": "Apache License, Version 2.0",
"version": "0.19.0",
"url": "https://docs.puppetlabs.com/mcollective/",
"timeout": 10
"url": "https://choria.io/",
"timeout": 2
},
"actions": [
{
Expand Down
4 changes: 2 additions & 2 deletions lib/mcollective/agent/scout.ddl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
metadata :name => "scout",
:description => "Choria Scout Management API",
:description => "Choria Scout Agent Management API",
:author => "R.I.Pienaar <[email protected]>",
:license => "Apache-2.0",
:version => "0.19.0",
:version => "0.0.1",
:url => "https://choria.io",
:provider => "golang",
:timeout => 5
Expand Down
4 changes: 2 additions & 2 deletions lib/mcollective/agent/scout.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"$schema": "https://choria.io/schemas/mcorpc/ddl/v1/agent.json",
"metadata": {
"name": "scout",
"description": "Choria Scout Management API",
"description": "Choria Scout Agent Management API",
"author": "R.I.Pienaar <[email protected]>",
"license": "Apache-2.0",
"version": "0.19.0",
"version": "0.0.1",
"url": "https://choria.io",
"provider": "golang",
"timeout": 5
Expand Down

0 comments on commit a067694

Please sign in to comment.