MCollective Agent Plugin package
(Not documented)
# File lib/mcollective/pluginpackager/agent_definition.rb, line 8
8: def initialize(configuration, mcdependency, plugintype)
9: @plugintype = plugintype
10: @path = configuration[:target]
11: @packagedata = {}
12: @revision = configuration[:revision] || 1
13: @preinstall = configuration[:preinstall]
14: @postinstall = configuration[:postinstall]
15: @vendor = configuration[:vendor] || "Puppet Labs"
16: @dependencies = configuration[:dependency] || []
17: @target_path = File.expand_path(@path)
18: @metadata, mcversion = PluginPackager.get_metadata(@path, "agent")
19: @mcname = mcdependency[:mcname] || "mcollective"
20: @mcversion = mcdependency[:mcversion] || mcversion
21: @metadata[:version] = (configuration[:version] || @metadata[:version])
22: @dependencies << {:name => "#{@mcname}-common", :version => @mcversion}
23: @metadata[:name] = (configuration[:pluginname] || @metadata[:name]).downcase.gsub(/\s+|_/, "-")
24: identify_packages
25: end
Obtain Agent package files and dependencies.
# File lib/mcollective/pluginpackager/agent_definition.rb, line 38
38: def agent
39: agent = {:files => [],
40: :dependencies => @dependencies.clone,
41: :description => "Agent plugin for #{@metadata[:name]}"}
42:
43: agentdir = File.join(@path, "agent")
44:
45: if PluginPackager.check_dir_present agentdir
46: ddls = Dir.glob(File.join(agentdir, "*.ddl"))
47: agent[:files] = (Dir.glob(File.join(agentdir, "*")) - ddls)
48: else
49: return nil
50: end
51: agent[:plugindependency] = {:name => "#{@mcname}-#{@metadata[:name]}-common", :version => @metadata[:version], :revision => @revision}
52: agent
53: end
Obtain client package files and dependencies.
# File lib/mcollective/pluginpackager/agent_definition.rb, line 56
56: def client
57: client = {:files => [],
58: :dependencies => @dependencies.clone,
59: :description => "Client plugin for #{@metadata[:name]}"}
60:
61: clientdir = File.join(@path, "application")
62: aggregatedir = File.join(@path, "aggregate")
63:
64: client[:files] += Dir.glob(File.join(clientdir, "*")) if PluginPackager.check_dir_present clientdir
65: client[:files] += Dir.glob(File.join(aggregatedir, "*")) if PluginPackager.check_dir_present aggregatedir
66: client[:plugindependency] = {:name => "#{@mcname}-#{@metadata[:name]}-common", :version => @metadata[:version], :revision => @revision}
67: client[:files].empty? ? nil : client
68: end
Obtain common package files and dependencies.
# File lib/mcollective/pluginpackager/agent_definition.rb, line 71
71: def common
72: common = {:files =>[],
73: :dependencies => @dependencies.clone,
74: :description => "Common libraries for #{@metadata[:name]}"}
75:
76: datadir = File.join(@path, "data", "**")
77: utildir = File.join(@path, "util", "**", "**")
78: ddldir = File.join(@path, "agent", "*.ddl")
79: validatordir = File.join(@path, "validator", "**")
80:
81: [datadir, utildir, validatordir, ddldir].each do |directory|
82: common[:files] += Dir.glob(directory)
83: end
84:
85: # We fail if there is no ddl file present
86: if common[:files].grep(/^.*\.ddl$/).empty?
87: raise "cannot create package - No ddl file found in #{File.join(@path, "agent")}"
88: end
89:
90: common[:files].empty? ? nil : common
91: end
Identify present packages and populate packagedata hash.
# File lib/mcollective/pluginpackager/agent_definition.rb, line 28
28: def identify_packages
29: common_package = common
30: @packagedata[:common] = common_package if common_package
31: agent_package = agent
32: @packagedata[:agent] = agent_package if agent_package
33: client_package = client
34: @packagedata[:client] = client_package if client_package
35: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.