Skip to content
fairchild edited this page Sep 13, 2010 · 11 revisions

Plugins are a cornerstone of PoolParty. When you call


apache do
end

You are using the apache2 plugin. I’m going to show you quickly how to get your plugin off the ground.

The basic template of a plugin looks like:


class PluginClass
  plugin :plugin_name do
    # Plugin methods here
  end
end

PoolParty gives the singleton method :plugin to the class allowing the above.

From there, you can call your plugin from within your pool.spec file.

When your plugin is called without a block, like so


	cloud :app do
		plugin_name
		...

The method that gets called is :enable.


	class PluginClass
	  plugin :plugin_name do
	    # Plugin methods here
		def enable
			has_file(:name => "/etc/cool/file/name")
		end
	  end
	end

Plugins use the same resources architecture as the spec file does, so has_ and does_not_have_ methods are all available on the plugin.

From within your plugin, you have access to the variables that are set on the plugin. For instance, if your plugin implementation requires a variable to be set, like so


# Pool.spec
...
plugin_name do
 set_this_on_my_plugin "this"
end

You can then call set_this_on_my_plugin from within your plugin and have access to the variable.

Available Plugins:

  1. apache2
  2. postgresql

Clone this wiki locally