Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
7a2df273
Commit
7a2df273
authored
Jan 15, 2014
by
Richard C Isaacson
Committed by
Michael DeHaan
Jan 28, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tested implementation adding action option for (add, delete, unique).
parent
c1982179
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
library/system/at
+8
-4
No files found.
library/system/at
View file @
7a2df273
...
...
@@ -97,7 +97,7 @@ def matching_jobs(module, at_cmd, script_file, user=None):
return
matching_jobs
# Read script_file into a string.
script_file_string
=
open
(
s
tring_file
)
.
read
()
script_file_string
=
open
(
s
cript_file
)
.
read
()
.
strip
()
# Loop through the jobs.
# If the script text is contained in a job add job number to list.
...
...
@@ -124,9 +124,9 @@ def main():
user
=
dict
(
required
=
False
),
command
=
dict
(
required
=
False
),
script_file
=
dict
(
required
=
False
),
unit_count
=
dict
(
required
=
Tru
e
,
unit_count
=
dict
(
required
=
Fals
e
,
type
=
'int'
),
unit_type
=
dict
(
required
=
Tru
e
,
unit_type
=
dict
(
required
=
Fals
e
,
default
=
None
,
choices
=
[
"minutes"
,
"hours"
,
"days"
,
"weeks"
],
type
=
"str"
),
...
...
@@ -147,6 +147,9 @@ def main():
unit_type
=
module
.
params
[
'unit_type'
]
action
=
module
.
params
[
'action'
]
if
((
action
==
'add'
)
and
(
not
unit_count
or
not
unit_type
)):
module
.
fail_json
(
msg
=
"add action requires unit_count and unit_type"
)
if
(
not
command
)
and
(
not
script_file
):
module
.
fail_json
(
msg
=
"command or script_file not specified"
)
...
...
@@ -154,6 +157,7 @@ def main():
module
.
fail_json
(
msg
=
"command and script_file are mutually exclusive"
)
result
=
{}
result
[
'action'
]
=
action
result
[
'changed'
]
=
False
# If command transform it into a script_file
...
...
@@ -177,7 +181,7 @@ def main():
# if unique if existing return unchanged
if
action
==
'unique'
:
if
not
matching_jobs
(
module
,
at_cmd
,
script_file
,
user
)
:
if
len
(
matching_jobs
(
module
,
at_cmd
,
script_file
,
user
))
!=
0
:
module
.
exit_json
(
**
result
)
result
[
'script_file'
]
=
script_file
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment