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
b00939ac
Commit
b00939ac
authored
Jan 14, 2014
by
Richard C Isaacson
Committed by
Michael DeHaan
Jan 28, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change to dynamically pick up the command from the PATH.
parent
9650c118
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
library/system/at
+6
-5
No files found.
library/system/at
View file @
b00939ac
...
@@ -66,11 +66,10 @@ EXAMPLES = '''
...
@@ -66,11 +66,10 @@ EXAMPLES = '''
import
os
import
os
import
tempfile
import
tempfile
ATCMD
=
"/usr/bin/at"
#================================================
#================================================
def
main
():
def
main
():
module
=
AnsibleModule
(
module
=
AnsibleModule
(
argument_spec
=
dict
(
argument_spec
=
dict
(
user
=
dict
(
required
=
False
),
user
=
dict
(
required
=
False
),
...
@@ -85,6 +84,8 @@ def main():
...
@@ -85,6 +84,8 @@ def main():
supports_check_mode
=
False
,
supports_check_mode
=
False
,
)
)
atcmd
=
module
.
get_bin_path
(
'at'
,
True
)
user
=
module
.
params
[
'user'
]
user
=
module
.
params
[
'user'
]
command
=
module
.
params
[
'command'
]
command
=
module
.
params
[
'command'
]
script_file
=
module
.
params
[
'script_file'
]
script_file
=
module
.
params
[
'script_file'
]
...
@@ -105,7 +106,7 @@ def main():
...
@@ -105,7 +106,7 @@ def main():
fileh
=
os
.
fdopen
(
filed
,
'w'
)
fileh
=
os
.
fdopen
(
filed
,
'w'
)
fileh
.
write
(
command
)
fileh
.
write
(
command
)
fileh
.
close
()
fileh
.
close
()
at_command
=
"
%
s now +
%
s
%
s -f
%
s"
%
(
ATCMD
,
unit_count
,
unit_type
,
path
)
at_command
=
"
%
s now +
%
s
%
s -f
%
s"
%
(
atcmd
,
unit_count
,
unit_type
,
path
)
if
user
:
if
user
:
at_command
=
"chown
%
s
%
s; su '
%
s' -c '
%
s'"
%
(
user
,
path
,
user
,
at_command
)
at_command
=
"chown
%
s
%
s; su '
%
s' -c '
%
s'"
%
(
user
,
path
,
user
,
at_command
)
rc
,
out
,
err
=
module
.
run_command
(
at_command
)
rc
,
out
,
err
=
module
.
run_command
(
at_command
)
...
@@ -115,9 +116,9 @@ def main():
...
@@ -115,9 +116,9 @@ def main():
result
[
'changed'
]
=
True
result
[
'changed'
]
=
True
elif
script_file
:
elif
script_file
:
result
[
'script_file'
]
=
script_file
result
[
'script_file'
]
=
script_file
at_command
=
"
%
s now +
%
s
%
s -f
%
s"
%
(
ATCMD
,
unit_count
,
unit_type
,
script_file
)
at_command
=
"
%
s now +
%
s
%
s -f
%
s"
%
(
atcmd
,
unit_count
,
unit_type
,
script_file
)
if
user
:
if
user
:
# We expect that if this is an installed the permissions are already correct for the user to execute it.
# We expect that if this is an installed the permissions are already correct for the user to execute it.
at_command
=
"su '
%
s' -c '
%
s'"
%
(
user
,
at_command
)
at_command
=
"su '
%
s' -c '
%
s'"
%
(
user
,
at_command
)
rc
,
out
,
err
=
module
.
run_command
(
at_command
)
rc
,
out
,
err
=
module
.
run_command
(
at_command
)
if
rc
!=
0
:
if
rc
!=
0
:
...
...
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