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

Added support for AIX System Resource Controller services promises #2959

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

craigcomstock
Copy link
Contributor

@craigcomstock craigcomstock commented Oct 18, 2024

On AIX the default will use AIX System Resource Controller commands to manage service state.

bundle agent main
{
  services:
    "sendmail"
      service_policy => "start";
}

service_policy options supported are: start, stop and reload.

Ticket: CFE-4447
Changelog: title

Copy link
Member

@nickanderson nickanderson left a comment

Choose a reason for hiding this comment

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

This looks OK to me. I commented a bit and have some non-blocking suggestions.

lib/services.cf Outdated
{
vars:
# current state can be: active, inoperative, stopping
"current_state" string => execresult("/usr/bin/lssrc -s $(service) | tail -1 | awk '{print $NF}'", useshell);
Copy link
Member

Choose a reason for hiding this comment

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

I have some small amount of worry about cached result here, it might benefit from action => immediate but I think it should be ok without it since $(service) comes from the parameter and that won't be set until real 3 pass actuation and not during pre-eval.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. :) Yeah, ideally folks shouldn't have to worry about it right?

What would be the problem about "cached result"?
I know that the commands in execresult are run a few times and cached in pre-eval and then in the real passes right?
Seems OK to me regardless as things will "work out"/stabilize eventually.

Copy link
Member

Choose a reason for hiding this comment

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

The problem with the cached result is that the state from pre-eval could be used instead of the state from when this is actuated.

Again, I don't think it applies here because $(service) would not be defined during pre-eval since it's only available as a parameter which will only happen during the normal 3 pass evaluation.

However, if this bundle happens to be called for the same service multiple times within the policy, then the cache is likely to apply which could cause some issue if you for example do:

start (but say it was already running), stop, start

In that second start the cached value from the first start would be used and with the knowledge it was running it may not try to start again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. I suppose it would be good to include a warning of some sort if you try to change the state of a service that has already been managed in the current agent run... kind of like a global class that signified e.g. "sshd_service_managed" and if you re-entered the aix_services() bundle and that class was set then log a warning that you shouldn't try to enforce more than one state on a service in a policy run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lib/services.cf Outdated Show resolved Hide resolved
lib/services.cf Outdated Show resolved Hide resolved
lib/services.cf Outdated Show resolved Hide resolved
On AIX the default will use AIX System Resource Controller commands to manage service state.

bundle agent main
{
  services:
    "sendmail"
      service_policy => "start";
}

service_policy options supported are: start, stop and reload.

Ticket: CFE-4447
Changelog: title
@craigcomstock craigcomstock merged commit 0022069 into cfengine:master Oct 18, 2024
4 checks passed
@craigcomstock craigcomstock deleted the CFE-4447/master branch October 18, 2024 20:02
@craigcomstock
Copy link
Contributor Author

@nickanderson do you want me to back-port this?

@craigcomstock craigcomstock added the cherry-pick? Fixes which may need to be cherry-picked to LTS branches label Oct 18, 2024
@nickanderson
Copy link
Member

Yeah I'd bring it to 3.24.x

@craigcomstock
Copy link
Contributor Author

#2960 (3.24)

@craigcomstock craigcomstock removed the cherry-pick? Fixes which may need to be cherry-picked to LTS branches label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants