Class: MCollective::PluginPackager::AgentDefinition
- Inherits:
-
Object
- Object
- MCollective::PluginPackager::AgentDefinition
- Defined in:
- lib/mcollective/pluginpackager/agent_definition.rb
Overview
MCollective Agent Plugin package
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
Returns the value of attribute dependencies.
-
#iteration ⇒ Object
Returns the value of attribute iteration.
-
#mcclient ⇒ Object
Returns the value of attribute mcclient.
-
#mccommon ⇒ Object
Returns the value of attribute mccommon.
-
#mcserver ⇒ Object
Returns the value of attribute mcserver.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#packagedata ⇒ Object
Returns the value of attribute packagedata.
-
#path ⇒ Object
Returns the value of attribute path.
-
#plugintype ⇒ Object
Returns the value of attribute plugintype.
-
#postinstall ⇒ Object
Returns the value of attribute postinstall.
-
#preinstall ⇒ Object
Returns the value of attribute preinstall.
-
#target_path ⇒ Object
Returns the value of attribute target_path.
-
#vendor ⇒ Object
Returns the value of attribute vendor.
Instance Method Summary collapse
-
#agent ⇒ Object
Obtain Agent package files and dependencies.
-
#client ⇒ Object
Obtain client package files and dependencies.
-
#common ⇒ Object
Obtain common package files and dependencies.
-
#identify_packages ⇒ Object
Identify present packages and populate packagedata hash.
-
#initialize(path, name, vendor, preinstall, postinstall, iteration, dependencies, mcodependency, plugintype) ⇒ AgentDefinition
constructor
A new instance of AgentDefinition.
Constructor Details
#initialize(path, name, vendor, preinstall, postinstall, iteration, dependencies, mcodependency, plugintype) ⇒ AgentDefinition
Returns a new instance of AgentDefinition.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 8 def initialize(path, name, vendor, preinstall, postinstall, iteration, dependencies, mcodependency, plugintype) @plugintype = plugintype @path = path @packagedata = {} @iteration = iteration || 1 @preinstall = preinstall @postinstall = postinstall @vendor = vendor || "Puppet Labs" @mcserver = mcodependency[:server] || "mcollective" @mcclient = mcodependency[:client] || "mcollective-client" @mccommon = mcodependency[:common] || "mcollective-common" @dependencies = dependencies || [] @target_path = File.(@path) @metadata = PluginPackager.(@path, "agent") @metadata[:name] = (name || @metadata[:name]).downcase.gsub(" ", "-") identify_packages end |
Instance Attribute Details
#dependencies ⇒ Object
Returns the value of attribute dependencies.
6 7 8 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 6 def dependencies @dependencies end |
#iteration ⇒ Object
Returns the value of attribute iteration.
5 6 7 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 5 def iteration @iteration end |
#mcclient ⇒ Object
Returns the value of attribute mcclient.
6 7 8 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 6 def mcclient @mcclient end |
#mccommon ⇒ Object
Returns the value of attribute mccommon.
6 7 8 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 6 def mccommon @mccommon end |
#mcserver ⇒ Object
Returns the value of attribute mcserver.
6 7 8 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 6 def mcserver @mcserver end |
#metadata ⇒ Object
Returns the value of attribute metadata.
5 6 7 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 5 def @metadata end |
#packagedata ⇒ Object
Returns the value of attribute packagedata.
5 6 7 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 5 def packagedata @packagedata end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 5 def path @path end |
#plugintype ⇒ Object
Returns the value of attribute plugintype.
6 7 8 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 6 def plugintype @plugintype end |
#postinstall ⇒ Object
Returns the value of attribute postinstall.
6 7 8 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 6 def postinstall @postinstall end |
#preinstall ⇒ Object
Returns the value of attribute preinstall.
5 6 7 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 5 def preinstall @preinstall end |
#target_path ⇒ Object
Returns the value of attribute target_path.
5 6 7 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 5 def target_path @target_path end |
#vendor ⇒ Object
Returns the value of attribute vendor.
5 6 7 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 5 def vendor @vendor end |
Instance Method Details
#agent ⇒ Object
Obtain Agent package files and dependencies.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 37 def agent agent = {:files => [], :dependencies => @dependencies.clone << @mcserver, :description => "Agent plugin for #{@metadata[:name]}"} agentdir = File.join(@path, "agent") if PluginPackager.check_dir_present agentdir ddls = Dir.glob(File.join(agentdir, "*.ddl")) agent[:files] = (Dir.glob(File.join(agentdir, "*")) - ddls) implementations = Dir.glob(File.join(@metadata[:name], "**")) agent[:files] += implementations unless implementations.empty? else return nil end agent[:dependencies] << "mcollective-#{@metadata[:name]}-common" if @packagedata[:common] agent end |
#client ⇒ Object
Obtain client package files and dependencies.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 57 def client client = {:files => [], :dependencies => @dependencies.clone << @mcclient, :description => "Client plugin for #{@metadata[:name]}"} clientdir = File.join(@path, "application") bindir = File.join(@path, "bin") ddldir = File.join(@path, "agent") client[:files] += Dir.glob(File.join(clientdir, "*")) if PluginPackager.check_dir_present clientdir client[:files] += Dir.glob(File.join(bindir,"*")) if PluginPackager.check_dir_present bindir client[:files] += Dir.glob(File.join(ddldir, "*.ddl")) if PluginPackager.check_dir_present ddldir client[:dependencies] << "mcollective-#{@metadata[:name]}-common" if @packagedata[:common] client[:files].empty? ? nil : client end |
#common ⇒ Object
Obtain common package files and dependencies.
74 75 76 77 78 79 80 81 82 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 74 def common common = {:files =>[], :dependencies => @dependencies.clone << @mccommon, :description => "Common libraries for #{@metadata[:name]}"} commondir = File.join(@path, "util") common[:files] += Dir.glob(File.join(commondir,"*")) if PluginPackager.check_dir_present commondir common[:files].empty? ? nil : common end |
#identify_packages ⇒ Object
Identify present packages and populate packagedata hash.
27 28 29 30 31 32 33 34 |
# File 'lib/mcollective/pluginpackager/agent_definition.rb', line 27 def identify_packages common_package = common @packagedata[:common] = common_package if common_package agent_package = agent @packagedata[:agent] = agent_package if agent_package client_package = client @packagedata[:client] = client_package if client_package end |