Onchange command in __config_file is not executed after state change #143

Closed
opened 2021-11-20 15:20:09 +00:00 by ungleich-gitea · 4 comments

Created by: lubo

When a config file state changes from present to absent, onchange command is not being run.

*Created by: lubo* When a config file state changes from present to absent, onchange command is not being run.
Author
Owner

Created by: darko-poljak

@lubo Ah, I see in type's source that in absent case onchange is not executed. This needs to be fixed.

*Created by: darko-poljak* @lubo Ah, I see in type's source that in absent case onchange is not executed. This needs to be fixed.
Author
Owner

Created by: darko-poljak

@lubo Did you try to write full path to nginx in "--onchange" argument? Just in case.

*Created by: darko-poljak* @lubo Did you try to write full path to nginx in "--onchange" argument? Just in case.
Author
Owner

Created by: lubo

@darko-poljak I might do that, I've opened this issue mainly as a reminder for myself. This is my use case:

I have a nginx site configuration file in /etc/nginx/conf.d/foobar.conf. After I remove it, I want nginx to no longer serve the site. So, this is how my __config_file command looks like:

__config_file "/etc/nginx/conf.d/foobar.conf" --onchange "nginx -s reload" --state absent

The problem is, the site is still accessible even though the config file was removed, which implies the onchange command was not executed. It works correctly when I add or change a config file, though.

*Created by: lubo* @darko-poljak I might do that, I've opened this issue mainly as a reminder for myself. This is my use case: I have a nginx site configuration file in `/etc/nginx/conf.d/foobar.conf`. After I remove it, I want nginx to no longer serve the site. So, this is how my `__config_file` command looks like: ```shell __config_file "/etc/nginx/conf.d/foobar.conf" --onchange "nginx -s reload" --state absent ``` The problem is, the site is still accessible even though the config file was removed, which implies the onchange command was not executed. It works correctly when I add or change a config file, though.
Author
Owner

Created by: darko-poljak

@lubo Can you perhaps fix this bug?
Do you have non-working case (init manifest sample) with expected result?

*Created by: darko-poljak* @lubo Can you perhaps fix this bug? Do you have non-working case (init manifest sample) with expected result?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ungleich-public/cdist#143
No description provided.