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
88acb487
Commit
88acb487
authored
Jun 10, 2014
by
Matt Martz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ANSIBLE_VERSION to module_utils/basic.py and manipulate the pyrax user-agent
parent
585fd5a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
18 deletions
+29
-18
lib/ansible/module_common.py
+4
-0
lib/ansible/module_utils/basic.py
+2
-0
lib/ansible/module_utils/rax.py
+23
-18
No files found.
lib/ansible/module_common.py
View file @
88acb487
...
...
@@ -25,11 +25,14 @@ import shlex
from
ansible
import
errors
from
ansible
import
utils
from
ansible
import
constants
as
C
from
ansible
import
__version__
REPLACER
=
"#<<INCLUDE_ANSIBLE_MODULE_COMMON>>"
REPLACER_ARGS
=
"
\"
<<INCLUDE_ANSIBLE_MODULE_ARGS>>
\"
"
REPLACER_COMPLEX
=
"
\"
<<INCLUDE_ANSIBLE_MODULE_COMPLEX_ARGS>>
\"
"
REPLACER_WINDOWS
=
"# POWERSHELL_COMMON"
REPLACER_VERSION
=
"
\"
<<ANSIBLE_VERSION>>
\"
"
class
ModuleReplacer
(
object
):
...
...
@@ -156,6 +159,7 @@ class ModuleReplacer(object):
encoded_complex
=
repr
(
complex_args_json
)
# these strings should be part of the 'basic' snippet which is required to be included
module_data
=
module_data
.
replace
(
REPLACER_VERSION
,
repr
(
__version__
))
module_data
=
module_data
.
replace
(
REPLACER_ARGS
,
encoded_args
)
module_data
=
module_data
.
replace
(
REPLACER_COMPLEX
,
encoded_complex
)
...
...
lib/ansible/module_utils/basic.py
View file @
88acb487
...
...
@@ -29,6 +29,8 @@
# == BEGIN DYNAMICALLY INSERTED CODE ==
ANSIBLE_VERSION
=
"<<ANSIBLE_VERSION>>"
MODULE_ARGS
=
"<<INCLUDE_ANSIBLE_MODULE_ARGS>>"
MODULE_COMPLEX_ARGS
=
"<<INCLUDE_ANSIBLE_MODULE_COMPLEX_ARGS>>"
...
...
lib/ansible/module_utils/rax.py
View file @
88acb487
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by
Ansible
#
still belong to the author of the module, and may assign their own license
# to the complete work.
# Modules you write using this snippet, which is embedded dynamically by
#
Ansible still belong to the author of the module, and may assign their own
#
license
to the complete work.
#
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2012-2013
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
modification,
# are permitted provided that the following conditions are met:
# Redistribution and use in source and binary forms, with or without
#
modification,
are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
notice,
#
this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Redistributions in binary form must reproduce the above copyright
#
notice, this list of conditions and the following disclaimer in the
#
documentation
and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
from
uuid
import
UUID
...
...
@@ -34,7 +36,7 @@ VOLUME_STATUS = ('available', 'attaching', 'creating', 'deleting', 'in-use',
'error'
,
'error_deleting'
)
CLB_ALGORITHMS
=
[
'RANDOM'
,
'LEAST_CONNECTIONS'
,
'ROUND_ROBIN'
,
'WEIGHTED_LEAST_CONNECTIONS'
,
'WEIGHTED_ROUND_ROBIN'
]
'WEIGHTED_LEAST_CONNECTIONS'
,
'WEIGHTED_ROUND_ROBIN'
]
CLB_PROTOCOLS
=
[
'DNS_TCP'
,
'DNS_UDP'
,
'FTP'
,
'HTTP'
,
'HTTPS'
,
'IMAPS'
,
'IMAPv4'
,
'LDAP'
,
'LDAPS'
,
'MYSQL'
,
'POP3'
,
'POP3S'
,
'SMTP'
,
'TCP'
,
'TCP_CLIENT_FIRST'
,
'UDP'
,
'UDP_STREAM'
,
'SFTP'
]
...
...
@@ -245,4 +247,7 @@ def setup_rax_module(module, rax_module):
except
Exception
,
e
:
module
.
fail_json
(
msg
=
'
%
s'
%
e
.
message
)
rax_module
.
USER_AGENT
=
'ansible/
%
s
%
s'
%
(
ANSIBLE_VERSION
,
rax_module
.
USER_AGENT
)
return
rax_module
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