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

(GH-225) Add custom_insync to rsapi docs #153

Merged
merged 1 commit into from
Jul 20, 2021
Merged

(GH-225) Add custom_insync to rsapi docs #153

merged 1 commit into from
Jul 20, 2021

Conversation

michaeltlombardi
Copy link
Contributor

This PR coincides with the work for puppetlabs/puppet-resource_api#225
to add the new custom_insync feature and functionality to rsapi resources;

It covers a common use case in the code and explains the purpose and some
implementation concerns.

DavidS
DavidS previously requested changes Apr 23, 2021
language/resource-api/README.md Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
@michaeltlombardi michaeltlombardi requested a review from DavidS May 17, 2021 02:46
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
language/resource-api/README.md Outdated Show resolved Hide resolved
end
```

In normal operations, the runtime environment uses strict value equality to determine if a resource instance needs to be state-enforced.
Copy link
Contributor

@clairecadman clairecadman May 27, 2021

Choose a reason for hiding this comment

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

Does this mean without using this new feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe say "When you don't use "custom_insync, the runtime environment etc...."?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As with all calls to `insync?`, a custom change reporting message can be surfaced by returning a string instead of `true` or `false`.
If no custom change reporting message is returned as a string, the change reporting in Puppet (if `false` is returned) will always be:

> Custom insync logic determined that this resource is out of sync
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the message the user would see?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

)

# lib/puppet/provider/test_custom_insync_hidden_property/test_custom_insync_hidden_property.rb
class Puppet::Provider::TestCustomInsyncHiddenProperty::TestCustomInsyncHiddenProperty
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this example showing compared to the first one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This shows an example without an insyncable property - which adds a hidden property to ensure that insync? is triggered.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah okay, maybe make that clearer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes that is better, thanks!

@michaeltlombardi michaeltlombardi marked this pull request as ready for review June 8, 2021 13:03
@michaeltlombardi michaeltlombardi requested a review from DavidS June 8, 2021 13:03
@michaeltlombardi
Copy link
Contributor Author

@clairecadman just pinging to see if my updates addressed your review comments :)

@clairecadman
Copy link
Contributor

@michaeltlombardi yes all good thanks! I don't want to change anything else as it would make it inconsistent with the rest of the README.

This commit coincides with the work for puppetlabs/puppet-resource_api#225
to add the new custom_insync feature and functionality to rsapi resources;

It covers a common use case in the code and explains the purpose and some
implementation concerns.
@michaeltlombardi michaeltlombardi dismissed DavidS’s stale review June 9, 2021 15:21

Addressed feedback.

If no properties were specified in the instance of a resource, `insync?` is not called.
The call happens during application of the catalog when the runtime environment decides whether or not it needs to enforce state on a specific resource.

The `insync?` method **must** return `nil`, `true` or `false` as the result of the property comparison:
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not explaining the new API requested by @joshcooper

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is resolved by the immediately following block which explains that the message only matters if the result is actually false:

image

@michaeltlombardi
Copy link
Contributor Author

@clairecadman, @DavidS, can we get a final approval and merge on this if there's nothing else?

@david22swan david22swan merged commit c187d95 into puppetlabs:master Jul 20, 2021
@michaeltlombardi michaeltlombardi deleted the gh-225/custom_insync_rsapi branch July 20, 2021 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants