Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added breadcrumb-file creation condition as attribute #268

Merged
merged 1 commit into from
Apr 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The disable recipe just stops redis and removes it from run levels.

The cookbook also contains a recipe to allow for the installation of the redis ruby gem.

Redis-sentinel will write configuration and state data back into its configuration file. This creates obvious problems when that config is managed by chef. This cookbook will create the config file once, and then leave a breadcrumb that will guard against the file from being updated again.
Redis-sentinel will write configuration and state data back into its configuration file. This creates obvious problems when that config is managed by chef. By default, this cookbook will create the config file once, and then leave a breadcrumb that will guard against the file from being updated again.

### Recipes

Expand Down Expand Up @@ -230,6 +230,21 @@ run_list *%w[
]
```

#### Install redis and setup two instances, on the same server, on different ports, the second instance configuration file will be overwriten by chef

```ruby
run_list *%w[
recipe[redisio]
recipe[redisio::enable]
]

default_attributes({
'redisio' => {
'servers' => [{'port' => '6379'}, {'port' => '6380', 'breadcrumb' => false}]
}
})
```


## LWRP Examples

Expand Down Expand Up @@ -366,7 +381,9 @@ Available options and their defaults
'cluster-enabled' => 'no',
'cluster-config-file' => nil, # Defaults to redis instance name inside of template if cluster is enabled.
'cluster-node-timeout' => 5000,
'includes' => nil
'includes' => nil,
'breadcrumb' => true # Defaults to create breadcrumb lock-file.

```

* `redisio['servers']` - An array where each item is a set of key value pairs for redis instance specific settings. The only required option is 'port'. These settings will override the options in 'default_settings', if it is left `nil` it will default to `[{'port' => '6379'}]`. If set to `[]` (empty array), no instances will be created.
Expand Down
3 changes: 2 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
'data_bag_item' => nil,
'data_bag_key' => nil,
'minslavestowrite' => nil,
'minslavesmaxlag' => nil
'minslavesmaxlag' => nil,
'breadcrumb' => true
}

# The default for this is set inside of the "install" recipe. This is due to the way deep merge handles arrays
Expand Down
1 change: 1 addition & 0 deletions providers/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def configure
file "#{current['configdir']}/#{server_name}.conf.breadcrumb" do
content 'This file prevents the chef cookbook from overwritting the redis config more than once'
action :create_if_missing
only_if { current['breadcrumb'] == true }
end

# Setup init.d file
Expand Down