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

Fixes #7529: Add support for the SRC system on AIX for service management #277

Conversation

jooooooon
Copy link
Member

@@ -36,7 +36,7 @@ bundle agent test

methods:

"ph" usebundle => service_management("${init.service}", "reload");
"ph" usebundle => service_action("${init.service}", "reload");
Copy link
Member Author

Choose a reason for hiding this comment

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

This bundle was renamed a while ago. It doesn't exist.

@@ -39,7 +39,14 @@ bundle agent service_action(service_name, action)

"action_command" string => "${paths.path[service]} ${service_name} ${action}";

!systemctl_utility_present.!service_utility_present.init_d_directory_present::
!systemctl_utility_present.!service_utility_present.startsrc_utility_present::
"svc_action_cmd[restart]" string => "/usr/bin/stopsrc -s ${service_name}; /usr/bin/startsrc -s ${service_name}";
Copy link
Member

Choose a reason for hiding this comment

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

This method may not always work: stopsrc says that the service was requested to stop, not that it stoped
cf https://www.ibm.com/developerworks/community/blogs/brian/entry/scripting_the_stop_and_restart_of_src_controlled_processes_on_aix6?lang=en

the common workaround is:
stopsrc -s sshd
sleep 10
startsrc -s sshd

the tricky one (and hard to make all purpose) is stopsrc -s sshd && until lssrc -s sshd | grep -q inoperative; do echo "Waiting for sshd to stop"; perl -e 'select(undef,undef,undef,.25)'; done && startsrc -s sshd

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, sounds good to me. I don't see why this is harder, though. Implementing.

@jooooooon
Copy link
Member Author

Please wait before merging - this is missing support for service_check_started_at_boot

@jooooooon
Copy link
Member Author

PR updated

@jooooooon jooooooon force-pushed the ust_7529/add_support_for_the_src_system_on_aix_for_service_management branch from 58da841 to adedf05 Compare December 3, 2015 08:46
@jooooooon
Copy link
Member Author

PR updated

@jooooooon jooooooon force-pushed the ust_7529/add_support_for_the_src_system_on_aix_for_service_management branch 2 times, most recently from c833f19 to 56dfe2a Compare December 3, 2015 08:54
@jooooooon
Copy link
Member Author

PR updated

@jooooooon jooooooon force-pushed the ust_7529/add_support_for_the_src_system_on_aix_for_service_management branch from 56dfe2a to 4ebfbb1 Compare December 3, 2015 09:10
@jooooooon
Copy link
Member Author

PR updated

@jooooooon
Copy link
Member Author

OK, this is ready for review and merge again!

@@ -35,7 +35,10 @@ bundle agent service_check_started_at_boot(service_name)
pass2.!systemctl_utility_present.chkconfig_utility_present::
"command_to_check" string => "${paths.path[chkconfig]} --list ${service_name} | grep -q -e 3:on -e B:on";

pass2.(!(systemctl_utility_present|chkconfig_utility_present)|broken_systemctl)::
pass2.!systemctl_utility_present.!chkconfig_utility_present.lsitab_utility_present::
"command_to_check" string => "lsitab -a | egrep '^${service_name}:[0-9]+:(respawn|boot|bootwait|wait|once|initdefault|sysinit):'";
Copy link
Member

Choose a reason for hiding this comment

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

could you use the full paths to the binaries ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wow, I'm amazed that CFEngine doesn't complain about this anymore!! Yes, of course, fixing

@jooooooon
Copy link
Member Author

PR updated

@jooooooon jooooooon force-pushed the ust_7529/add_support_for_the_src_system_on_aix_for_service_management branch from 4ebfbb1 to 92750eb Compare December 3, 2015 09:32
@jooooooon
Copy link
Member Author

PR updated

@jooooooon jooooooon force-pushed the ust_7529/add_support_for_the_src_system_on_aix_for_service_management branch from 92750eb to 2f23092 Compare December 3, 2015 09:38
redhat::
"service_name" string => "crond";
aix::
"service_name" string => "sshd";
Copy link
Member

Choose a reason for hiding this comment

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

Given that most of the time the machine doing the test will be controlled by someone like us you can use a use a less critical service like syslogd, snmpd or inetd.

Copy link
Member Author

Choose a reason for hiding this comment

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

True, but this is just a check. No harm can be done.

@jooooooon jooooooon force-pushed the ust_7529/add_support_for_the_src_system_on_aix_for_service_management branch from 2f23092 to c5ad40d Compare December 3, 2015 11:11
@jooooooon
Copy link
Member Author

PR updated

@jooooooon
Copy link
Member Author

PR updated

@jooooooon jooooooon force-pushed the ust_7529/add_support_for_the_src_system_on_aix_for_service_management branch from c5ad40d to db0a659 Compare December 3, 2015 11:41
@peckpeck
Copy link
Member

peckpeck commented Dec 3, 2015

Good, merging

peckpeck added a commit that referenced this pull request Dec 3, 2015
…rc_system_on_aix_for_service_management

Fixes #7529: Add support for the SRC system on AIX for service management
@peckpeck peckpeck merged commit e4de471 into Normation:v0.x Dec 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants