Skip to content

Commit 41f1d24

Browse files
authored
Merge pull request #228 from vmware/jenkins_sync_30.2.4_ansible_collection
Auto updated assets for ansible collection 30.2.4
2 parents 9e0478d + 62d808d commit 41f1d24

File tree

146 files changed

+6649
-12092
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+6649
-12092
lines changed

README.md

Lines changed: 130 additions & 136 deletions
Large diffs are not rendered by default.

docs/avi_applicationpersistenceprofile.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,38 @@ Parameters
371371
- Default value when not specified in API or module is interpreted by Avi Controller as PERSISTENCE_TYPE_CLIENT_IP_ADDRESS.
372372
</div>
373373
</td>
374+
</tr>
375+
<tr>
376+
<td colspan="2">
377+
<div class="ansibleOptionAnchor" id="parameter-"></div>
378+
<b>persistence_update_interval</b>
379+
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
380+
<div style="font-size: small">
381+
<span style="color: purple">int</span>
382+
</div>
383+
</td>
384+
<td>
385+
</td>
386+
<td>
387+
<div style="font-size: small">
388+
- Interval in minutes at which refreshed persistence entries are synced to peer ses.
389+
</div>
390+
<div style="font-size: small">
391+
- If not set, it willsync at an interval of timeout/2.
392+
</div>
393+
<div style="font-size: small">
394+
- Allowed values are 1-30.
395+
</div>
396+
<div style="font-size: small">
397+
- Field introduced in 30.2.4.
398+
</div>
399+
<div style="font-size: small">
400+
- Unit is min.
401+
</div>
402+
<div style="font-size: small">
403+
- Allowed in enterprise edition with any value, enterprise with cloud services edition.
404+
</div>
405+
</td>
374406
</tr>
375407
<tr>
376408
<td colspan="2">

docs/avi_pulse_registration.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,10 @@ Parameters
331331
- For generation of the jwt_token paste the related link in Incognito window to prevent IdP from considering any existing valid login session
332332
</div>
333333
<div style="font-size: small">
334-
- If controller is running >= 21.1.3 and is in ENTERPRISE tier then visit URL :https://portal.avipulse.vmware.com/portal/controller/auth/ctrllogin
334+
- If controller is running >= 21.1.3 and is in ENTERPRISE tier then visit URL :https://portal.pulse.broadcom.com/portal/controller/auth/ctrllogin
335335
</div>
336336
<div style="font-size: small">
337-
- If controller is running >= 21.1.3 and is in SAAS tier then visit URL :https://portal.avipulse.vmware.com/portal/controller/auth/ccctrllogin
337+
- If controller is running >= 21.1.3 and is in SAAS tier then visit URL :https://portal.pulse.broadcom.com/portal/controller/auth/ccctrllogin
338338
</div>
339339
<div style="font-size: small">
340340
- jwt_token is valid for 365 days.

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ tags:
1818
- load
1919
- balancer
2020
- sdk
21-
version: 30.2.3
21+
version: 30.2.4

meta/runtime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
requires_ansible: '>=2.15.0'
2+
requires_ansible: '>=2.9.10'

plugins/doc_fragments/avi.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,6 @@ class ModuleDocFragment(object):
105105
description:
106106
- Specifies whether it is an Avi controller or Saas controller
107107
type: str
108-
ssl_cert:
109-
description:
110-
- Specifies the ssl cert
111-
type: str
112-
ssl_key:
113-
description:
114-
- Specifies the ssl key
115-
type: str
116108
type: dict
117109
api_context:
118110
description:

plugins/module_utils/avi_api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import logging
1111
import time
1212
import ipaddress
13+
import socket
1314

1415
if sys.version_info < (3, 5):
1516
from urlparse import urlparse
@@ -224,7 +225,7 @@ def __init__(self, controller_ip=None, username=None, password=None,
224225
port=None, timeout=60, api_version=None,
225226
retry_conxn_errors=True, data_log=False,
226227
avi_credentials=None, session_id=None, csrftoken=None,
227-
lazy_authentication=False, max_api_retries=None, csp_host=CSP_HOST, csp_token=None, user_hdrs={}, ssl_cert=None, ssl_key=None):
228+
lazy_authentication=False, max_api_retries=None, csp_host=CSP_HOST, csp_token=None, user_hdrs=None, ssl_cert=None, ssl_key=None):
228229
"""
229230
ApiSession takes ownership of avi_credentials and may update the
230231
information inside it.
@@ -270,7 +271,7 @@ def __init__(self, controller_ip=None, username=None, password=None,
270271
self.verify = verify
271272
self.retry_conxn_errors = retry_conxn_errors
272273
self.remote_api_version = {}
273-
self.user_hdrs = user_hdrs
274+
self.user_hdrs = user_hdrs if user_hdrs else {}
274275
self.data_log = data_log
275276
self.num_session_retries = 0
276277
self.num_api_retries = 0
Lines changed: 38 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
# Copyright 2021 VMware, Inc.
22
# SPDX-License-Identifier: Apache License 2.0
33

4-
from __future__ import absolute_import, division, print_function
4+
from __future__ import (absolute_import, division, print_function)
55

66
__metaclass__ = type
77

8-
from ansible_collections.vmware.alb.plugins.module_utils.avi_api import (ApiSession, APIError)
9-
import sys
8+
from ansible_collections.vmware.alb.plugins.module_utils.avi_api import ApiSession, \
9+
APIError
1010
import logging
1111
import time
12-
13-
if sys.version_info < (3, 5):
14-
pass
15-
else:
16-
pass
17-
1812
from requests import ConnectionError
1913
from requests.exceptions import ChunkedEncodingError
2014
from ssl import SSLError
@@ -25,114 +19,69 @@
2519

2620

2721
class CSPApiSession(ApiSession):
28-
CSP_HOST = "console.cloud.vmware.com"
22+
CSP_HOST = 'console.cloud.vmware.com'
2923

30-
def __init__(
31-
self,
32-
controller_ip=None,
33-
username=None,
34-
password=None,
35-
token=None,
36-
tenant=None,
37-
tenant_uuid=None,
38-
verify=False,
39-
port=None,
40-
timeout=60,
41-
api_version=None,
42-
retry_conxn_errors=True,
43-
data_log=False,
44-
avi_credentials=None,
45-
session_id=None,
46-
csrftoken=None,
47-
lazy_authentication=False,
48-
max_api_retries=None,
49-
csp_host=CSP_HOST,
50-
csp_token=None,
51-
user_hdrs=None,
52-
):
24+
def __init__(self, controller_ip=None, username=None, password=None,
25+
token=None, tenant=None, tenant_uuid=None, verify=False,
26+
port=None, timeout=60, api_version=None,
27+
retry_conxn_errors=True, data_log=False,
28+
avi_credentials=None, session_id=None, csrftoken=None,
29+
lazy_authentication=False, max_api_retries=None, csp_host=CSP_HOST, csp_token=None, user_hdrs=None):
5330

5431
super(CSPApiSession, self).__init__(
55-
controller_ip,
56-
username,
57-
password,
58-
token,
59-
tenant,
60-
tenant_uuid,
61-
verify,
62-
port,
63-
timeout,
64-
api_version,
65-
retry_conxn_errors,
66-
data_log,
67-
avi_credentials,
68-
session_id,
69-
csrftoken,
70-
lazy_authentication,
71-
max_api_retries,
72-
csp_host,
73-
csp_token,
74-
user_hdrs,
75-
)
32+
controller_ip, username, password, token,
33+
tenant, tenant_uuid, verify,
34+
port, timeout, api_version,
35+
retry_conxn_errors, data_log,
36+
avi_credentials, session_id, csrftoken,
37+
lazy_authentication, max_api_retries, csp_host, csp_token, user_hdrs)
7638
return
7739

7840
def generate_access_token(self):
7941
"""
8042
Generate authentication token from CSP Token
8143
"""
8244
body = {}
83-
headers = {"Content-Type": "application/x-www-form-urlencoded"}
45+
headers = {
46+
'Content-Type': 'application/x-www-form-urlencoded'
47+
}
8448
if self.avi_credentials.csp_token:
8549
body["api_token"] = self.avi_credentials.csp_token
8650
else:
87-
raise APIError(
88-
"CSP API Token is not provided for csp login %s" % self.csp_prefix
89-
)
90-
logger.debug(
91-
"authenticating using api token %s prefix %s",
92-
self.avi_credentials.csp_token,
93-
self.csp_prefix,
94-
)
51+
raise APIError("CSP API Token is not provided for csp login %s" % self.csp_prefix)
52+
logger.debug('authenticating using api token %s prefix %s',
53+
self.avi_credentials.csp_token, self.csp_prefix)
9554
self.cookies.clear()
9655
err = None
9756
try:
9857
rsp = super().post(
99-
self.csp_prefix + "/am/api/auth/api-tokens/authorize",
100-
body,
101-
headers=headers,
102-
verify=self.verify,
103-
)
58+
self.csp_prefix + "/am/api/auth/api-tokens/authorize", body, headers=headers,
59+
verify=self.verify)
10460

10561
if rsp.status_code == 200:
10662
self.num_session_retries = 0
107-
authorization_token = {
108-
"Authorization": "Bearer %s" % (rsp.json().get("access_token"))
109-
}
63+
authorization_token = {"Authorization": "Bearer %s" % (rsp.json().get('access_token'))}
11064
self.headers.update(authorization_token)
111-
logger.debug(
112-
"authentication success for user %s", self.avi_credentials.csp_token
113-
)
65+
logger.debug("authentication success for user %s",
66+
self.avi_credentials.csp_token)
11467
return
11568
# Check for bad request and invalid credentials response code
11669
elif rsp.status_code in [401, 403]:
117-
logger.error("Status Code %s msg %s", rsp.status_code, rsp.text)
118-
err = APIError(
119-
"Failed: %s Status Code %s msg %s",
120-
(rsp.url, rsp.status_code, rsp.text),
121-
rsp,
122-
)
70+
logger.error('Status Code %s msg %s',
71+
rsp.status_code, rsp.text)
72+
err = APIError('Failed: %s Status Code %s msg %s', (
73+
rsp.url, rsp.status_code, rsp.text), rsp)
12374
raise err
12475
else:
125-
logger.error("Error status code %s msg %s", rsp.status_code, rsp.text)
126-
err = APIError(
127-
"Failed: %s Status Code %s msg %s"
128-
% (rsp.url, rsp.status_code, rsp.text),
129-
rsp,
130-
)
76+
logger.error("Error status code %s msg %s", rsp.status_code,
77+
rsp.text)
78+
err = APIError('Failed: %s Status Code %s msg %s' % (
79+
rsp.url, rsp.status_code, rsp.text), rsp)
13180
raise err
13281
except (ConnectionError, SSLError, ChunkedEncodingError) as e:
13382
if not self.retry_conxn_errors:
13483
raise
135-
logger.warning("Connection error retrying %s", e)
84+
logger.warning('Connection error retrying %s', e)
13685
err = e
13786
# comes here only if there was either exception or login was not
13887
# successful
@@ -141,11 +90,8 @@ def generate_access_token(self):
14190
self.num_session_retries += 1
14291
if self.num_session_retries > self.max_session_retries:
14392
self.num_session_retries = 0
144-
logger.error(
145-
"giving up after %d retries connection failure %s",
146-
self.max_session_retries,
147-
True,
148-
)
93+
logger.error("giving up after %d retries connection failure %s",
94+
self.max_session_retries, True)
14995
raise err
15096
self.generate_access_token()
15197
return

0 commit comments

Comments
 (0)