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
940419d0
Commit
940419d0
authored
Aug 30, 2013
by
Serge van Ginderachter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some fixes and cleanup per feedback from Matt Hite
parent
2005332e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
+28
-9
library/net_infrastructure/bigip_monitor_http
+28
-9
No files found.
library/net_infrastructure/bigip_monitor_http
View file @
940419d0
...
...
@@ -73,7 +73,7 @@ options:
aliases: ['monitor']
partition:
description:
- Partition
- Partition
for the monitor
required: false
default: 'Common'
choices: []
...
...
@@ -85,6 +85,13 @@ options:
default: 'http'
choices: []
aliases: []
parent_partition:
description:
- Partition for the parent monitor
required: false
default: 'Common'
choices: []
aliases: []
send:
description:
required: true
...
...
@@ -147,7 +154,14 @@ def monitor_exists(module, api, monitor, parent):
def
create_monitor
(
api
,
monitor
,
template_attributes
):
api
.
LocalLB
.
Monitor
.
create_template
(
templates
=
[{
'template_name'
:
monitor
,
'template_type'
:
TEMPLATE_TYPE
}],
template_attributes
=
[
template_attributes
])
try
:
api
.
LocalLB
.
Monitor
.
create_template
(
templates
=
[{
'template_name'
:
monitor
,
'template_type'
:
TEMPLATE_TYPE
}],
template_attributes
=
[
template_attributes
])
except
bigsuds
.
OperationFailed
,
e
:
if
"already exists"
in
str
(
e
):
pass
else
:
# genuine exception
raise
def
delete_monitor
(
api
,
monitor
):
...
...
@@ -173,6 +187,9 @@ def set_string_property(api, monitor, str_property):
# ===========================================
# main loop
#
# writing a module for other monitor types should
# only need an updated main()
def
main
():
...
...
@@ -185,6 +202,7 @@ def main():
state
=
dict
(
default
=
'present'
,
choices
=
[
'present'
,
'absent'
]),
name
=
dict
(
required
=
True
),
parent
=
dict
(
default
=
DEFAULT_PARENT_TYPE
),
parent_partition
=
dict
(
default
=
'Common'
),
send
=
dict
(
required
=
True
),
receive
=
dict
(
required
=
True
)
),
...
...
@@ -198,15 +216,14 @@ def main():
user
=
module
.
params
[
'user'
]
password
=
module
.
params
[
'password'
]
partition
=
module
.
params
[
'partition'
]
parent_partition
=
module
.
params
[
'parent_partition'
]
state
=
module
.
params
[
'state'
]
name
=
module
.
params
[
'name'
]
parent
=
"/
%
s/
%
s"
%
(
partition
,
module
.
params
[
'parent'
])
parent
=
"/
%
s/
%
s"
%
(
par
ent_par
tition
,
module
.
params
[
'parent'
])
monitor
=
"/
%
s/
%
s"
%
(
partition
,
name
)
send
=
module
.
params
[
'send'
]
receive
=
module
.
params
[
'receive'
]
# sanity check user supplied values
# main logic
...
...
@@ -239,15 +256,17 @@ def main():
if
monitor_exists
(
module
,
api
,
monitor
,
parent
):
for
str_property
in
template_string_properties
:
if
not
check_string_property
(
api
,
monitor
,
str_property
):
set_string_property
(
api
,
monitor
,
str_property
)
if
not
module
.
check_mode
:
set_string_property
(
api
,
monitor
,
str_property
)
result
[
'changed'
]
=
True
else
:
print
(
api
,
monitor
,
template_attributes
)
elif
not
module
.
check_mode
:
create_monitor
(
api
,
monitor
,
template_attributes
)
print
"check"
for
str_property
in
template_string_properties
:
set_string_property
(
api
,
monitor
,
str_property
)
result
[
'changed'
]
=
True
else
:
# monitor does not exist and check mode
result
[
'changed'
]
=
True
except
Exception
,
e
:
module
.
fail_json
(
msg
=
"received exception:
%
s"
%
e
)
...
...
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