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

Fixes #32078 - explicitly notify dynflow core service on changes #653

Merged
merged 1 commit into from
Mar 16, 2021

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented Mar 12, 2021

No description provided.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I kind of feel like this would be redundant because ~> is already a notification. You can check this with the .that_notifies() matcher.

spec/classes/foreman_proxy__plugin__dynflow_spec.rb Outdated Show resolved Hide resolved
@evgeni
Copy link
Member Author

evgeni commented Mar 15, 2021

I kind of feel like this would be redundant because ~> is already a notification. You can check this with the .that_notifies() matcher.

Well, no. A ~> B ~> C doesn't make a notify from A to C, and that's what was missing here.

@evgeni
Copy link
Member Author

evgeni commented Mar 15, 2021

The interesting thing is: that_notifies doesn't fail w/o my patch, and yet there is no notification if you look at the puppet logs.

@ekohl
Copy link
Member

ekohl commented Mar 15, 2021

Well, no. A ~> B ~> C doesn't make a notify from A to C, and that's what was missing here.

It was always my understanding that it does make that notify. Let's see if I can create a minimal reproducer.

@ekohl
Copy link
Member

ekohl commented Mar 15, 2021

Given the following code:

file { '/tmp/file.txt':
  content => "Hello World!\n",
}
~> file { '/tmp/directory':
  ensure => directory,
}
~> service { 'postfix':
  ensure => running,
  enable => true,
}

Then if you run:

# puppet apply test.pp
...
# echo something > /tmp/file.txt
# puppet apply --debug test.pp
...
Info: Applying configuration version '1615809989'
Debug: /Stage[main]/Main/File[/tmp/file.txt]/notify: notify to File[/tmp/directory]
Debug: /Stage[main]/Main/File[/tmp/directory]/notify: notify to Service[postfix]
Notice: /Stage[main]/Main/File[/tmp/file.txt]/content: content changed '{sha256}625275dca783645310e6a62741564055bb0a9d9c6cc01847ace82ec215a3273f' to '{sha256}03ba204e50d126e4674c005e04d82e84c21366780af1f43bd54a37816b6ab340'
Debug: /Stage[main]/Main/File[/tmp/file.txt]: The container Class[Main] will propagate my refresh event
Debug: Executing: '/bin/systemctl is-active -- postfix'
Debug: Executing: '/bin/systemctl is-enabled -- postfix'
Debug: Class[Main]: The container Stage[main] will propagate my refresh event
Debug: Finishing transaction 12100
Debug: Storing state
Debug: Pruned old state cache entries in 0.00 seconds
Debug: Stored state in 0.01 seconds
Notice: Applied catalog in 0.05 seconds
...

So that supports your observation. However, as you also observed, rspec-puppet doesn't make it easy to verify. https://rspec-puppet.com/documentation/classes/#testing-relationships-between-resources doesn't really go into it.

Now I'm questioning if this is a bug in Puppet or a bug rspec-puppet.

manifests/plugin/dynflow.pp Outdated Show resolved Hide resolved
@evgeni
Copy link
Member Author

evgeni commented Mar 15, 2021

Now I'm questioning if this is a bug in Puppet or a bug rspec-puppet.

Or both? ;)

Let me challenge the "but we know someone over there!" and ping @DavidS ;)

@ekohl
Copy link
Member

ekohl commented Mar 15, 2021

I've submitted rodjek/rspec-puppet#821 as a minimal reproducer.

@evgeni
Copy link
Member Author

evgeni commented Mar 16, 2021

FWIW, I tried puppet agent 4.0.0, 5.0.0, 6.0.0 and 7.4.1, neither of them add a A~>C notification automatically with the above code.

@evgeni
Copy link
Member Author

evgeni commented Mar 16, 2021

@ekohl should I add back the "with_notify" test, as that at least correctly expresses the intent of the change with actually failing if it's not present?

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I'm not sure if with_notify is that useful to test here. It's hardcoded there and there are no variables. I question how many bugs we would catch with it. Let's merge it as is now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants