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

deleted bosh config leaves dangling hm rule #2393

Merged
merged 1 commit into from
Aug 3, 2022

Conversation

nouseforaname
Copy link
Contributor

start with no existing bosh configs of type resurrection

create a config of type resurrection via bosh updatei-confighealthmanager
will create a rule for that config that it tracks internally in the @parsed_rules
array.

number of bosh configs of type resurrection == 1
parsed rules array length == 1

run bosh delete-config

number of bosh configs of type resurrection == 0
parsed rules array length == 1

The problem is in the return early. While it makes sense to return
early if the argument for the method call is nil, it didn't make
sense to return early if the argument was set to an empty array.
Because we actually want the array to be empty if we try to delete
the last resurrection config.

Effectively this issue will cache the contents of the last rule. In a
scenario where the global config is ON and the contents of the last
rule were used to override that value for deployment XYZ, even after
deleting the rule, deployment XYZ would have the resurrection switched
off because the rule in health manager was never deleted even if the
bosh config didn't exists anymore.

start with no existing bosh configs of type resurrection

create a config of type resurrection via `bosh updatei-config`healthmanager
will create a rule for that config that it tracks internally in the `@parsed_rules`
array.

```
number of bosh configs of type resurrection == 1
parsed rules array length == 1
```

run `bosh delete-config`

```
number of bosh configs of type resurrection == 0
parsed rules array length == 1
```

The problem is in the return early. While it makes sense to return
early if the argument for the method call is nil, it didn't make
sense to return early if the argument was set to an empty array.
Because we actually want the array to be empty if we try to delete
the last resurrection config.

Effectively this issue will cache the contents of the last rule. In a
scenario where the global config is ON and the contents of the last
rule were used to override that value for deployment XYZ, even after
deleting the rule, deployment XYZ would have the resurrection switched
off because the rule in health manager was never deleted even if the
bosh config didn't exists anymore.
Copy link
Contributor

@ramonskie ramonskie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ramonskie ramonskie merged commit dd09005 into main Aug 3, 2022
@ramonskie ramonskie deleted the bugfix/resurrection-config-cached-even-if-deleted branch August 3, 2022 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants