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

Fixed job delete logic to cover RHEL6, CentOS6, *BSD and Solaris #228

Closed
wants to merge 1 commit into from
Closed

Fixed job delete logic to cover RHEL6, CentOS6, *BSD and Solaris #228

wants to merge 1 commit into from

Conversation

saito-hideki
Copy link
Collaborator

@saito-hideki saito-hideki commented Jul 23, 2021

SUMMARY
  • at -r command-line option does not work on RHEL6 and CentOS6. Therefore, we will need to modify delete logic to use atrm command instead of at -r.
  • Fixed search logic for job_id to perform correctly on *BSD and Solaris.
ISSUE TYPE
COMPONENT NAME
  • ansible.posix.at
ADDITIONAL INFORMATION
  • RHEL6 and CentOS6 does not have at -r option:
$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.10 (Santiago)
$ at -r
at: invalid option -- 'r'
Usage: at [-V] [-q x] [-f file] [-mMlbv] timespec ...
       at [-V] [-q x] [-f file] [-mMlbv] -t time
       at -c job ...
       atq [-V] [-q x]
       at [ -rd ] job ...
       atrm [-V] job ...
       batch
  • The order of the job id number in the output column of atq on FreeBSD are different from Linux. We need to take care of the difference of job id position.
FreeBSD and NetBSD: job id is located at the end of the columns.
~~~
Date				Owner		Queue	Job#
Wed Dec 31 00:00:00 UTC 2200	root            c	9
~~~

OpenBSD: job id is located in the middle of the columns.
~~~
   Rank     Execution Date     Owner          Job       Queue
  1st   Jan  1, 2022 00:00   root       1640962800.c   c
~~~

Solaris: job id is located in the middle of the columns
~~~
 Rank     Execution Date     Owner      Job            Queue   Job Name
  1st   Jan  1, 2022 00:00   root       1640962800.a     a     stdin
~~~

Linux: job id is located at the beginning of the columns.
~~~
26	2022-01-01 00:00 a root
~~~
  • at -c is different behavior on Solaris. So we need to read /var/spool/cron/atjobs/<job_id> to confirm the job details instead of at -c on Solaris nodes.

@saito-hideki saito-hideki changed the title [WIP] Modify to use atrm to delete jobs scheduled with at module [WIP] Fixed job delete logic with RHEL6, CentOS6 and *BSD Jul 24, 2021
@saito-hideki saito-hideki changed the title [WIP] Fixed job delete logic with RHEL6, CentOS6 and *BSD Fixed job delete logic to cover RHEL6, CentOS6 and *BSD Jul 24, 2021
@saito-hideki saito-hideki changed the title Fixed job delete logic to cover RHEL6, CentOS6 and *BSD [WIP] Fixed job delete logic to cover RHEL6, CentOS6 and *BSD Jul 24, 2021
@saito-hideki
Copy link
Collaborator Author

saito-hideki commented Jul 24, 2021

It seems necessary to consider the behavior of get_matching_jobs() for Solaris. Therefore, I'll revert this PR to WIP.
https://github.com/ansible-collections/ansible.posix/blob/main/plugins/modules/at.py#L99

=> Fixed and waiting for the code review.

@saito-hideki saito-hideki changed the title [WIP] Fixed job delete logic to cover RHEL6, CentOS6 and *BSD [WIP] Fixed job delete logic to cover RHEL6, CentOS6, *BSD and Solaris Aug 4, 2021
@saito-hideki
Copy link
Collaborator Author

Closing and re-opening for CI trigger.

@saito-hideki saito-hideki reopened this Aug 4, 2021
@saito-hideki saito-hideki changed the title [WIP] Fixed job delete logic to cover RHEL6, CentOS6, *BSD and Solaris Fixed job delete logic to cover RHEL6, CentOS6, *BSD and Solaris Aug 4, 2021
@saito-hideki saito-hideki requested a review from Akasurde August 4, 2021 05:44
* To avoid the "invalid option" error on RHEL6 and CentOS6,
  modified delete logic to use "atrm" command instead of "at -r".
* Fixed search logic for job_id to perform delete correctly on *BSD and Solaris.

Signed-off-by: Hideki Saito <[email protected]>
@saito-hideki
Copy link
Collaborator Author

@Akasurde is there any chance to review this PR? I don't know how many use cases there are in CentOS 6, but I think it's good that delete logic works properly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants