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
e78c5f92
Commit
e78c5f92
authored
Oct 21, 2014
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Python3 fixes
parent
a9542209
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
10 deletions
+21
-10
v2/ansible/parsing/__init__.py
+1
-1
v2/ansible/parsing/vault/__init__.py
+2
-2
v2/ansible/playbook/base.py
+3
-3
v2/test/errors/test_errors.py
+1
-1
v2/test/plugins/__init__.py
+5
-0
v2/test/plugins/test_plugins.py
+9
-3
No files found.
v2/ansible/parsing/__init__.py
View file @
e78c5f92
...
...
@@ -219,5 +219,5 @@ def load_data_from_file(path, vault_password=None):
try
:
return
load_data
(
data
)
except
YAMLError
,
exc
:
except
YAMLError
as
exc
:
process_yaml_error
(
exc
,
data
,
path
,
show_content
)
v2/ansible/parsing/vault/__init__.py
View file @
e78c5f92
...
...
@@ -191,7 +191,7 @@ class VaultEditor(object):
raise
errors
.
AnsibleError
(
"
%
s exists, please use 'edit' instead"
%
self
.
filename
)
# drop the user into vim on file
old_umask
=
os
.
umask
(
0077
)
old_umask
=
os
.
umask
(
0
o
077
)
call
(
self
.
_editor_shell_command
(
self
.
filename
))
tmpdata
=
self
.
read_data
(
self
.
filename
)
this_vault
=
VaultLib
(
self
.
password
)
...
...
@@ -225,7 +225,7 @@ class VaultEditor(object):
raise
errors
.
AnsibleError
(
CRYPTO_UPGRADE
)
# make sure the umask is set to a sane value
old_mask
=
os
.
umask
(
0077
)
old_mask
=
os
.
umask
(
0
o
077
)
# decrypt to tmpfile
tmpdata
=
self
.
read_data
(
self
.
filename
)
...
...
v2/ansible/playbook/base.py
View file @
e78c5f92
...
...
@@ -37,7 +37,7 @@ class Base:
# each class knows attributes set upon it, see Task.py for example
self
.
_attributes
=
dict
()
for
(
name
,
value
)
in
self
.
_get_base_attributes
()
.
iteritems
(
):
for
(
name
,
value
)
in
iteritems
(
self
.
_get_base_attributes
()
):
self
.
_attributes
[
name
]
=
value
.
default
def
_get_base_attributes
(
self
):
...
...
@@ -72,7 +72,7 @@ class Base:
ds
=
self
.
munge
(
ds
)
# walk all attributes in the class
for
(
name
,
attribute
)
in
self
.
_get_base_attributes
()
.
iteritems
(
):
for
(
name
,
attribute
)
in
iteritems
(
self
.
_get_base_attributes
()
):
# copy the value over unless a _load_field method is defined
if
name
in
ds
:
...
...
@@ -91,7 +91,7 @@ class Base:
''' validation that is done at parse time, not load time '''
# walk all fields in the object
for
(
name
,
attribute
)
in
self
.
_get_base_attributes
()
.
iteritems
(
):
for
(
name
,
attribute
)
in
iteritems
(
self
.
_get_base_attributes
()
):
# run validator only if present
method
=
getattr
(
self
,
'_validate_
%
s'
%
name
,
None
)
...
...
v2/test/errors/test_errors.py
View file @
e78c5f92
...
...
@@ -57,7 +57,7 @@ class TestErrors(unittest.TestCase):
m
=
mock_open
()
m
.
return_value
.
readlines
.
return_value
=
[
'this is line 1
\n
'
]
with
patch
(
'
__builtin__.open'
,
m
):
with
patch
(
'
{0}.open'
.
format
(
BUILTINS
)
,
m
):
# this line will be found in the file
self
.
obj
.
_data_source
=
'foo.yml'
self
.
obj
.
_line_number
=
1
...
...
v2/test/plugins/__init__.py
View file @
e78c5f92
...
...
@@ -14,3 +14,8 @@
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
v2/test/plugins/test_plugins.py
View file @
e78c5f92
...
...
@@ -15,10 +15,16 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
import
os
import
unittest
from
ansible.compat.tests
import
unittest
from
ansible.compat.tests
import
BUILTINS
from
mock
import
mock_open
,
patch
,
MagicMock
from
ansible.compat.tests.
mock
import
mock_open
,
patch
,
MagicMock
from
ansible.plugins
import
MODULE_CACHE
,
PATH_CACHE
,
PLUGIN_PATH_CACHE
,
_basedirs
,
push_basedir
,
PluginLoader
...
...
@@ -54,7 +60,7 @@ class TestErrors(unittest.TestCase):
m
=
MagicMock
()
m
.
return_value
.
__file__
=
'/path/to/my/test.py'
pl
=
PluginLoader
(
'test'
,
'foo.bar.bam'
,
'test'
,
'test_plugin'
)
with
patch
(
'
__builtin__.__import__'
,
m
):
with
patch
(
'
{0}.__import__'
.
format
(
BUILTINS
)
,
m
):
self
.
assertEqual
(
pl
.
_get_package_paths
(),
[
'/path/to/my/bar/bam'
])
def
test_plugins__get_paths
(
self
):
...
...
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