Skip to content

[Bug]: Insync? not invoked for Puppet::Property::Boolean #11

Open
@h-haaks

Description

@h-haaks

Is this a critical security issue?

No

  • This is not a security issue.

Describe the Bug

I have a custom type with a boolean property defined as

newproperty(:myprop, parent: Puppet::Property::Boolean) do
end

On puppet run when 'is' value is true and 'should' value is false, the insync? is never invoked and puppet does not change the value of the property!
I think the problem is here https://github.com/OpenVoxProject/puppet/blob/main/lib/puppet/property.rb#L274
when @should is false at this point safe_insync? never invoke insync?

Since Puppet::Property blocks type implementations from overriding `safe_insync? this bug really makes it impossible to use Puppet::Property::Boolean as parent in custom type properties.

Expected Behavior

When there is an actual state change for a property using Puppet::Property::Boolean as parent I expect puppet to change the value.

Steps to Reproduce

Create a custom type with a property like mentioned.
Write the provider so that instances/prefetch set the property to true.
Test type with property set to false.

Environment

All supported versions

Additional Context

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions