- 
                Notifications
    You must be signed in to change notification settings 
- Fork 94
Add support for Chef Solo/RightScale, fill out metadata, more directive support in template #4
base: master
Are you sure you want to change the base?
Changes from 8 commits
21a19dd
              f51fcc2
              133b8c9
              05088e8
              c245e6f
              c336562
              e227ec4
              5d951bb
              31ab29e
              b0784d9
              7956367
              4af9da1
              f38bd22
              053af26
              675091f
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -5,3 +5,86 @@ | |
| long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
| version "1.0.0" | ||
| supports "ubuntu" | ||
|  | ||
| depends "apache2" | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It only depends on apache2 if collectd_web is used. We don't use it for example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kpumuk Chef doesn't support optional dependencies (in metadata) so technically its a dependency. What the best practice is, I'm not sure but personally I think its better to do this as recipes don't have a mechanism to even check nicely on the cookbook needed (which would also create a lot of extra redundant code in every cookbook that has optional deps). | ||
|  | ||
| %w{ debian ubuntu centos redhat fedora }.each do |os| | ||
| supports os | ||
| end | ||
|  | ||
| recipe "collectd", "Install a standalone daemon." | ||
| recipe "collectd::client", "Install collectd and configure it to send data to a server." | ||
| recipe "collectd::server", "Install collectd and configure it to recieve data from clients." | ||
| recipe "collectd::collectd_web", "Installs and configures collectd_web." | ||
|  | ||
| attribute "collectd/base_dir", | ||
| :display_name => "collectd Base Directory", | ||
| :description => "The base directory for collectd.", | ||
| :required => "optional", | ||
| :default => "/var/lib/collectd", | ||
| :recipes => [ "collectd::default" ] | ||
|  | ||
| attribute "collectd/plugin_dir", | ||
| :display_name => "collectd Plugin Directory", | ||
| :description => "The plugin directory for collectd.", | ||
| :required => "optional", | ||
| :default => "/usr/lib/collectd" , | ||
| :recipes => [ "collectd::default" ] | ||
|  | ||
| attribute "collectd/types_db", | ||
| :display_name => "collectd Types Database", | ||
| :description => "The location of the collectd types.db file.", | ||
| :required => "optional", | ||
| :type => "array", | ||
| :default => [ "/usr/share/collectd/types.db" ], | ||
| :recipes => [ "collectd::default" ] | ||
|  | ||
| attribute "collectd/interval", | ||
| :display_name => "collectd Polling Interval", | ||
| :description => "The collectd interval setting value.", | ||
| :required => "optional", | ||
| :default => "20", | ||
| :recipes => [ "collectd::default" ] | ||
|  | ||
| attribute "collectd/read_threads", | ||
| :display_name => "collectd Read Threads", | ||
| :description => "The collectd read threads setting value.", | ||
| :required => "optional", | ||
| :default => "5", | ||
| :recipes => [ "collectd::default" ] | ||
|  | ||
| #attribute "collectd/servers", | ||
| # :display_name => "collectd Servers", | ||
| # :description => "The collectd servers to send to as a client.", | ||
| # :required => "optional", | ||
| # :default => nil, | ||
| # :type => "array", | ||
| # :recipes => [ "collectd::client" ] | ||
|  | ||
| attribute "collectd/hostname", | ||
| :display_name => "collectd Hostname", | ||
| :description => "The collectd Hostname setting value.", | ||
| :required => "optional", | ||
| :recipes => [ "collectd::default" ] | ||
|  | ||
| attribute "collectd/fqdn_lookup", | ||
| :display_name => "collectd FQDNLookup", | ||
| :description => "The collectd FQDNLookup setting value.", | ||
| :required => "optional", | ||
| :recipes => [ "collectd::default" ], | ||
| :choice => [ "true", "false" ], | ||
| :default => "true" | ||
|  | ||
| attribute "collectd/collectd_web/path", | ||
| :display_name => "collectd_web path", | ||
| :description => "The collectd_web install path.", | ||
| :required => "optional", | ||
| :default => "/srv/collectd_web", | ||
| :recipes => [ "collectd::collectd_web" ] | ||
|  | ||
| attribute "collectd/collectd_web/hostname", | ||
| :display_name => "collectd_web hostname", | ||
| :description => "The collectd_web hostname.", | ||
| :required => "optional", | ||
| :default => "collectd", | ||
| :recipes => [ "collectd::collectd_web" ] | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -19,9 +19,13 @@ | |
|  | ||
| include_recipe "collectd" | ||
|  | ||
| servers = [] | ||
| search(:node, 'recipes:"collectd::server"') do |n| | ||
| servers << n['fqdn'] | ||
| if node['collectd']['servers'] or Chef::Config[:solo] | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than just use an empty list in Solo, it would probably be better to raise an error. As I write this, it can probably be more generalized to either solo or client that finding 0 servers should be an error. What do you think of this logic? servers = if !node[:collectd][:servers].empty?
  node[:collectd][:servers]
elsif !Chef::Config[:solo]
  search(:node, 'recipes:"collectd::server"').map {|n| n['fqdn'] }
else
 []
end
raise "something" if servers.empty? | ||
| servers = node['collectd']['servers'] | ||
| else | ||
| servers = [] | ||
| search(:node, 'recipes:"collectd::server"') do |n| | ||
| servers << n['fqdn'] | ||
| end | ||
| end | ||
|  | ||
| if servers.empty? | ||
|  | @@ -30,4 +34,4 @@ | |
|  | ||
| collectd_plugin "network" do | ||
| options :server=>servers | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason to use a string instead of a real Ruby boolean? Usually nice to use native types when possible.