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
476b0f6d
Commit
476b0f6d
authored
Feb 09, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for patch module to have master as src
parent
9db17afc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
lib/ansible/runner/action_plugins/patch.py
+66
-0
No files found.
lib/ansible/runner/action_plugins/patch.py
0 → 100644
View file @
476b0f6d
# (c) 2015, Brian Coca <briancoca+dev@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
import
os
from
ansible
import
utils
from
ansible.runner.return_data
import
ReturnData
class
ActionModule
(
object
):
def
__init__
(
self
,
runner
):
self
.
runner
=
runner
def
run
(
self
,
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
=
None
,
**
kwargs
):
options
=
{}
if
complex_args
:
options
.
update
(
complex_args
)
options
.
update
(
utils
.
parse_kv
(
module_args
))
src
=
options
.
get
(
'src'
,
None
)
dest
=
options
.
get
(
'dest'
,
None
)
remote_src
=
utils
.
boolean
(
options
.
get
(
'remote_src'
,
'yes'
))
if
src
is
None
or
dest
is
None
:
result
=
dict
(
failed
=
True
,
msg
=
"src and dest are required"
)
return
ReturnData
(
conn
=
conn
,
comm_ok
=
False
,
result
=
result
)
if
remote_src
:
return
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'patch'
,
module_args
,
inject
=
inject
,
complex_args
=
complex_args
)
# Source is local
if
'_original_file'
in
inject
:
src
=
utils
.
path_dwim_relative
(
inject
[
'_original_file'
],
'files'
,
src
,
self
.
runner
.
basedir
)
else
:
src
=
utils
.
path_dwim
(
self
.
runner
.
basedir
,
src
)
tmp_src
=
tmp
+
src
conn
.
put_file
(
src
,
tmp_src
)
if
self
.
runner
.
sudo
and
self
.
runner
.
sudo_user
!=
'root'
or
self
.
runner
.
su
and
self
.
runner
.
su_user
!=
'root'
:
if
not
self
.
runner
.
noop_on_check
(
inject
):
self
.
runner
.
_remote_chmod
(
conn
,
'a+r'
,
tmp_src
,
tmp
)
new_module_args
=
dict
(
src
=
tmp_src
,
)
if
self
.
runner
.
noop_on_check
(
inject
):
new_module_args
[
'CHECKMODE'
]
=
True
module_args
=
utils
.
merge_module_args
(
module_args
,
new_module_args
)
return
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'patch'
,
module_args
,
inject
=
inject
,
complex_args
=
complex_args
)
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