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
469a1250
Commit
469a1250
authored
Apr 02, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving new patch action plugin over to v2
parent
cd81666e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
v2/ansible/plugins/action/patch.py
+66
-0
No files found.
v2/ansible/plugins/action/patch.py
0 → 100644
View file @
469a1250
# (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
# Make coding more python3-ish
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
import
os
from
ansible.plugins.action
import
ActionBase
from
ansible.utils.boolean
import
boolean
class
ActionModule
(
ActionBase
):
def
run
(
self
,
tmp
=
None
,
task_vars
=
dict
()):
src
=
self
.
_task
.
args
.
get
(
'src'
,
None
)
dest
=
self
.
_task
.
args
.
get
(
'dest'
,
None
)
remote_src
=
boolean
(
self
.
_task
.
args
.
get
(
'remote_src'
,
'no'
))
if
src
is
None
:
return
dict
(
failed
=
True
,
msg
=
"src is required"
)
elif
remote_src
:
# everyting is remote, so we just execute the module
# without changing any of the module arguments
return
self
.
_execute_module
()
if
self
.
_task
.
_role
is
not
None
:
src
=
self
.
_loader
.
path_dwim_relative
(
self
.
_task
.
_role
.
_role_path
,
'files'
,
src
)
else
:
src
=
self
.
_loader
.
path_dwim
(
src
)
# create the remote tmp dir if needed, and put the source file there
if
tmp
is
None
or
"-tmp-"
not
in
tmp
:
tmp
=
self
.
_make_tmp_path
()
tmp_src
=
self
.
_shell
.
join_path
(
tmp
,
os
.
path
.
basename
(
src
))
self
.
_connection
.
put_file
(
src
,
tmp_src
)
if
self
.
_connection_info
.
become
and
self
.
_connection_info
.
become_user
!=
'root'
:
# FIXME: noop stuff here
#if not self.runner.noop_on_check(inject):
# self._remote_chmod('a+r', tmp_src, tmp)
self
.
_remote_chmod
(
'a+r'
,
tmp_src
,
tmp
)
new_module_args
=
self
.
_task
.
args
.
copy
()
new_module_args
.
update
(
dict
(
src
=
tmp_src
,
)
)
return
self
.
_execute_module
(
'patch'
,
module_args
=
new_module_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