Skip to content
auser edited this page Sep 13, 2010 · 8 revisions

Resources provide the basis for the configuration of PoolParty.

Note

This Wiki page is somewhat outdated. Resource handling should be done with chef recipes.

Using these methods are discouraged, but can be accessed on the monitors branch of the repos.

There are built-in resources that PoolParty gives you for free to use in your clouds.rb or your plugins. These include:


	class_package
	conditional
	cron
	custom_service
	directory
	exec
	file
	gem_package
	host
	mount
	package
	remote_file
	sshkey
	symlink
	variable
	deploydirectory
	git
	line
	rsyncmirror
	svn
        plugin

These can all be called from within your plugins or your clouds.rb by preceding them with either has_ or does_not_have_ to indicate whether your cloud should have or not have their resources.

For instance


	has_package(:name => "apache2")

indicates that we want the package apache2 installed on our cloud.

Resources are easy to create.

Say you have a resource that you want to create, you can make one by subclassing PoolParty::Resources::Resource like so


	module PoolParty
	 module Resources
	  class MyCoolResource < Resource
	   default_options({})
	  end
	 end
	end

Then you can call your resource like so in your clouds.rb file:


	has_my_cool_resource(:name => "funky funky")

You can also create virtual resources, the preferred method of creating your own resource. To create a virtual resource, such as a virtualhost for the apache2 plugin, or a database for the mysql plugin, simply call:


	virtual_resource(:virtual_resource_name) do
	end

These can then be called from plugins or clouds.rb the same way with


	has_virtual_resource_name(:name => "cool virtual resource")
Clone this wiki locally