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

Merge 2.6 Into Develop #10367

Merged
merged 29 commits into from
Jun 22, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fb3ded8
Tie the watcher lifecycle to the catacomb
SimonRichardson Jun 18, 2019
f60a226
Merge pull request #10341 from SimonRichardson/1833155-watcher-leak
jujubot Jun 19, 2019
bc4821b
Improve error checks to cater for 'not found' provider errors that do…
anastasiamac Jun 20, 2019
93a5dbe
add provider level IsNotFound-equivalent methods to providers that ar…
anastasiamac Jun 20, 2019
3d6378c
add provider level IsNotFound-equivalent methods to providers that ar…
anastasiamac Jun 20, 2019
0b44fac
Rename commit command to branch. Enhance renamed branch command to
hmlanigan Jun 18, 2019
9d0975f
Add Created, CreatedBy, and CompletedBy to a Branch in the model cache,
hmlanigan Jun 20, 2019
12d2082
Merge pull request #10359 from hmlanigan/createdtomodelcache
jujubot Jun 20, 2019
208f334
Merge pull request #10346 from hmlanigan/branch
jujubot Jun 20, 2019
4023a75
diversify handling of operational compute errors.
anastasiamac Jun 20, 2019
b1d584c
Use waiterror.
anastasiamac Jun 20, 2019
9a1a7a2
Only inspect errors after all attempts to run an operation have been …
anastasiamac Jun 20, 2019
ef3098c
adjust tests
anastasiamac Jun 21, 2019
16155dd
adjust tests
anastasiamac Jun 21, 2019
25ab285
Merge pull request #10354 from anastasiamac/provider-not-found-errors-25
jujubot Jun 21, 2019
5fd7824
Merge branch '2.5' into merge-25-26-2106
anastasiamac Jun 21, 2019
501494a
Merge branch '2.5' into merge-25-26-2106
anastasiamac Jun 21, 2019
a6d900b
Merge pull request #10362 from anastasiamac/merge-25-26-2106
jujubot Jun 21, 2019
c2391c8
Fixes case where watcher for unit not tracking any branch starts trac…
manadart Jun 21, 2019
56d6c10
Merge pull request #10364 from manadart/2.6-config-watch-branch-deter…
jujubot Jun 21, 2019
d9d191f
Relocates uniter access control method generation to a new module for…
manadart Jun 20, 2019
ee944e0
Moves event matchers from the modelcache_test package to core/cache/c…
manadart Jun 21, 2019
b78e03e
Adds new testing infrastructure for filling a cache with objects from…
manadart Jun 21, 2019
b345347
Internalises events notification channel in testing cache controller.
manadart Jun 21, 2019
32e0618
Makes cachetest event matchers into function declarations instead of …
manadart Jun 21, 2019
f402984
Adds copyright header to new cachetest matchers module.
manadart Jun 21, 2019
7671273
Merge pull request #10366 from manadart/2.6-cache-testing-infrastructure
jujubot Jun 21, 2019
fec148b
Merge branch 'upstream/2.6' into 2.6-into-develop
manadart Jun 21, 2019
e89fa76
Removes call to deprecated WantsVote method in cachetest package.
manadart Jun 21, 2019
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
22 changes: 10 additions & 12 deletions core/cache/charmconfigwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ type charmConfigWatcherConfig struct {
}

// CharmConfigWatcher watches application charm config on behalf of a unit.
// The configuration is based on whether the unit is tracking an active model branch.
// If keys are specified the watcher only signals a change when at least one
// of those keys changes value. If no keys are specified,
// any change in the config will trigger the watcher to notify.
// The watcher will notify if either of the following events cause a change
// to the unit's effective configuration:
// - Changes to the charm config settings for the unit's application.
// - Changes to a model branch being tracked by the unit.
type CharmConfigWatcher struct {
*notifyWatcherBase

Expand All @@ -62,9 +62,8 @@ type CharmConfigWatcher struct {
configHash string
}

// newUnitConfigWatcher returns a new watcher for the input config keys
// with a baseline hash of their config values from the input hash cache.
// As per the cache requirements, hashes are only generated from sorted keys.
// newUnitConfigWatcher returns a new watcher for the unit indicated in the
// input configuration.
func newCharmConfigWatcher(cfg charmConfigWatcherConfig) (*CharmConfigWatcher, error) {
w := &CharmConfigWatcher{
notifyWatcherBase: newNotifyWatcherBase(),
Expand Down Expand Up @@ -153,11 +152,10 @@ func (w *CharmConfigWatcher) branchChanged(_ string, msg interface{}) {
}

// If we do not know whether we are tracking this branch, find out.
if w.branchName == "" {
if w.isTracking(b) {
w.branchName = b.Name()
}
} else if w.branchName != b.Name() {
if w.branchName == "" && w.isTracking(b) {
w.branchName = b.Name()
}
if w.branchName != b.Name() {
return
}

Expand Down
20 changes: 20 additions & 0 deletions core/cache/charmconfigwatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,26 @@ func (s *charmConfigWatcherSuite) TestTrackingBranchChangedNotified(c *gc.C) {
w.AssertStops()
}

func (s *charmConfigWatcherSuite) TestNotTrackingBranchChangedNotNotified(c *gc.C) {
// This will initialise the watcher without branch info.
w := s.newWatcher(c, "redis/9")
s.assertWatcherConfig(c, w, map[string]interface{}{})

// Publish a branch change with altered config.
b := Branch{
details: BranchChange{
Name: branchName,
Config: map[string]settings.ItemChanges{"redis": {settings.MakeAddition("password", "new-pass")}},
},
}
s.Hub.Publish(branchChange, b)

// Nothing should change.
w.AssertNoChange()
s.assertWatcherConfig(c, w, map[string]interface{}{})
w.AssertStops()
}

func (s *charmConfigWatcherSuite) TestDifferentBranchChangedNotNotified(c *gc.C) {
w := s.newWatcher(c, "redis/0")

Expand Down