Parent

Class/Module Index [+]

Quicksearch

MCollective::PluginPackager::AgentDefinition

MCollective Agent Plugin package

Attributes

iteration[RW]
metadata[RW]
packagedata[RW]
path[RW]
plugintype[RW]
postinstall[RW]
target_path[RW]
vendor[RW]

Public Instance Methods

agent() click to toggle source

Obtain Agent package files and dependencies.

# File lib/mcollective/pluginpackager/agent_definition.rb, line 29
def agent
  agent = {:files => [],
           :dependencies => ["mcollective"],
           :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() click to toggle source

Obtain client package files and dependencies.

# File lib/mcollective/pluginpackager/agent_definition.rb, line 50
def client
  client = {:files => [],
            :dependencies => ["mcollective-client"],
            :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() click to toggle source

Obtain common package files and dependencies.

# File lib/mcollective/pluginpackager/agent_definition.rb, line 67
def common
  common = {:files =>[],
            :dependencies => ["mcollective-common"],
            :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() click to toggle source

Identify present packages and populate packagedata hash.

# File lib/mcollective/pluginpackager/agent_definition.rb, line 22
def identify_packages
  @packagedata[:common] = common
  @packagedata[:agent] = agent
  @packagedata[:client] = client
end

Public Class Methods

new(path, name, vendor, postinstall, iteration, plugintype) click to toggle source
# File lib/mcollective/pluginpackager/agent_definition.rb, line 8
def initialize(path, name, vendor, postinstall, iteration, plugintype)
  @plugintype = plugintype
  @path = path
  @packagedata = {}
  @iteration = iteration || 1
  @postinstall = postinstall
  @vendor = vendor || "Puppet Labs"
  @target_path = File.expand_path(@path)
  @metadata = PluginPackager.get_metadata(@path, "agent")
  @metadata[:name] = (name || @metadata[:name]).downcase.gsub(" ", "_")
  identify_packages
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.