This repository has been archived by the owner on Jun 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Update to add an instance_id attribute. #26
Open
saheemg
wants to merge
12
commits into
bloomberg:master
Choose a base branch
from
saheemg:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7def855
Update to add an instance_id attribute.
saheemg 684bda4
Added instance_id.
saheemg 0a60fc1
Merge pull request #1 from InfrastructureEngineering/addInstanceId
yogeswaran c796fdd
Update to avoid constant zookeeper restart.
saheemg 704eafc
Merge pull request #2 from InfrastructureEngineering/addInstanceId
yogeswaran 515f950
Make sure to no include ensemble when using dynamic config.
saheemg 08fd2cd
review comment.
saheemg b464968
Merge pull request #3 from InfrastructureEngineering/betterZookeeper3…
yogeswaran aa74d25
Revert "Make sure to no include ensemble when using dynamic config."
saheemg 3f76335
Merge pull request #4 from InfrastructureEngineering/revert-3-betterZ…
saheemg 8b28885
review comment
saheemg 2bc6d1e
removed extra space.
saheemg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,17 +26,15 @@ class ZookeeperConfig < Chef::Resource | |
attribute(:group, kind_of: String, default: 'zookeeper') | ||
|
||
attribute(:instance_name, kind_of: String, required: true) | ||
attribute(:instance_id, kind_of: String, default: lazy { ensemble.index(instance_name).next.to_s }) | ||
alias_method :myid, :instance_id | ||
attribute(:data_dir, kind_of: String, default: '/var/lib/zookeeper') | ||
attribute(:client_port, kind_of: Integer, default: 2181) | ||
attribute(:leader_port, kind_of: Integer, default: 2888) | ||
attribute(:election_port, kind_of: Integer, default: 3888) | ||
attribute(:ensemble, kind_of: Array, default: [], required: true) | ||
attribute(:properties, option_collector: true, default: {}) | ||
|
||
def myid | ||
ensemble.index(instance_name).next.to_s | ||
end | ||
|
||
# Outputs the +properties+ in the Java Properties file format. This is | ||
# what Zookeeper daemon consumes to tweak its internal configuration. | ||
def to_s | ||
|
@@ -67,9 +65,22 @@ def to_s | |
mode '0644' | ||
end | ||
|
||
file new_resource.path do | ||
# create zoo.properties.static file and only update | ||
# zoo.properties when static file has changed. | ||
# this is needed to ensure chef won't constantly update | ||
# zoo.properties and force restarts of zookeeper when | ||
# it dynamically updates zoo.properties. | ||
file new_resource.path+".static" do | ||
content new_resource.to_s | ||
mode '0644' | ||
notifies :create, 'file[config_base]', :immediately | ||
end | ||
|
||
file 'config_base' do | ||
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. Are you creating a file called |
||
content new_resource.to_s | ||
path new_resource.path | ||
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. Ah missed that, nevermind. |
||
mode '0644' | ||
action :nothing | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why is the file continually updating? This mechanism won't change that it just makes it more obfuscated.