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

(MODULES-6714) - inifile: ensure absent not working with refreshonly = true #313

Merged

Conversation

Lavinia-Dan
Copy link
Contributor

@Lavinia-Dan Lavinia-Dan commented Nov 9, 2018

Solution:
Check for events before executing create, destroy or value update
Added acceptance tests for events

Problem description:
When removing a setting in a section with refreshonly set to true the setting is not completely removed. Only the value is removed.
Expect to remove the setting.

exec { 'testexec':
command => '/bin/true',
notify => Ini_Setting['testing'],
}

ini_setting { "testing":
ensure => absent,
path => '/tmp/t.txt',
section => 'section1',
setting => 'valueinsection1',
refreshonly => true,
}

What happened:
refreshonly was added specifically to refresh a value when there's an event that triggers a notification that is why the setting didn't get removed although the destroy method was triggered before the refreshonly (which only added back the setting with an empty value, because of this line:
provider.value = self[:value] if self[:refreshonly] and because the manifest which was supposed to remove the setting had no value defined, thus the empty string )

Upon further investigation even if an event was being triggered or not, the ini_setting manifest was going be executed. This is why I added the insync? method inside the ensurable block, we want to listen for an event if we're using refreshonly attribute, and only then execute, the manifest.

@Lavinia-Dan Lavinia-Dan force-pushed the MODULES-6714-ensure-absent-refreshonly branch 2 times, most recently from d7705d6 to c2e4700 Compare November 9, 2018 13:28
@pmcmaw pmcmaw changed the title MODULES-6714 inifile: ensure absent not working with refreshonly = true (MODULES-6714) - inifile: ensure absent not working with refreshonly = true Nov 9, 2018
@pmcmaw
Copy link
Contributor

pmcmaw commented Nov 9, 2018

Currently running changes through our internal adhoc pipeline to ensure there are no issues on our Windows builds.

Copy link
Contributor

@pmcmaw pmcmaw left a comment

Choose a reason for hiding this comment

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

Currently there are failures on the Windows pipeline.

@Lavinia-Dan Lavinia-Dan force-pushed the MODULES-6714-ensure-absent-refreshonly branch from c6612ac to 0d18e57 Compare November 9, 2018 16:38
@Lavinia-Dan Lavinia-Dan force-pushed the MODULES-6714-ensure-absent-refreshonly branch from 5633acf to 374bb70 Compare November 13, 2018 07:53
@pmcmaw pmcmaw merged commit 67230b2 into puppetlabs:master Nov 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants