Skip to content

Commit 2bba35c

Browse files
authored
Merge pull request #18 from sap-linuxlab/main
Merge back from main to dev
2 parents 96c1a30 + dae0525 commit 2bba35c

13 files changed

+829
-30
lines changed

plugins/module_utils/constants.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
URL_SERVICE_INCIDENT = 'https://launchpad.support.sap.com/services/odata/incidentws'
77
URL_SERVICE_USER_ADMIN = 'https://launchpad.support.sap.com/services/odata/useradminsrv'
88
URL_SOFTWARE_DOWNLOAD = 'https://softwaredownloads.sap.com'
9-
# Maintainance Planner
10-
URL_MAINTAINANCE_PLANNER = 'https://maintenanceplanner.cfapps.eu10.hana.ondemand.com'
9+
# Maintenance Planner
10+
URL_MAINTENANCE_PLANNER = 'https://maintenanceplanner.cfapps.eu10.hana.ondemand.com'
11+
URL_SYSTEMS_PROVISIONING = 'https://launchpad.support.sap.com/services/odata/i7p/odata/bkey'
1112
URL_USERAPPS = 'https://userapps.support.sap.com/sap/support/mp/index.html'
1213
URL_USERAPP_MP_SERVICE = 'https://userapps.support.sap.com/sap/support/mnp/services'
1314
URL_LEGACY_MP_API = 'https://tech.support.sap.com/sap/support/mnp/services'

plugins/module_utils/sap_api_common.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/usr/bin/env python3
2-
# coding: utf-8
3-
41
import logging
52
import re
63
from urllib.parse import urlparse
@@ -37,7 +34,7 @@ def _request(url, **kwargs):
3734
if 'allow_redirects' not in kwargs:
3835
kwargs['allow_redirects'] = True
3936

40-
method = 'POST' if kwargs.get('data') else 'GET'
37+
method = 'POST' if kwargs.get('data') or kwargs.get('json') else 'GET'
4138
res = https_session.request(method, url, **kwargs)
4239
res.raise_for_status()
4340

plugins/module_utils/sap_id_sso.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/usr/bin/env python3
2-
# coding: utf-8
3-
41
import json
52
import logging
63
import re

plugins/module_utils/sap_launchpad_maintenance_planner_runner.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#!/user/bin/env python3
2-
# coding: utf-8
3-
4-
import os
51
import pathlib
62
import re
73
import time
@@ -11,11 +7,10 @@
117
from bs4 import BeautifulSoup
128
from lxml import etree
139
from requests.auth import HTTPBasicAuth
14-
from requests.sessions import session
1510

1611
from . import constants as C
1712
from .sap_api_common import _request, https_session
18-
from .sap_id_sso import _get_sso_endpoint_meta, sap_sso_login
13+
from .sap_id_sso import _get_sso_endpoint_meta
1914

2015
_MP_XSRF_TOKEN = None
2116
_MP_TRANSACTIONS = None
@@ -24,7 +19,7 @@
2419
def auth_maintenance_planner():
2520
# Clear mp relevant cookies for avoiding unexpected responses.
2621
_clear_mp_cookies('maintenanceplanner')
27-
res = _request(C.URL_MAINTAINANCE_PLANNER)
22+
res = _request(C.URL_MAINTENANCE_PLANNER)
2823
sig_re = re.compile('signature=(.*?);path=\/";location="(.*)"')
2924
signature, redirect = re.search(sig_re, res.text).groups()
3025

@@ -35,7 +30,7 @@ def auth_maintenance_planner():
3530
'locationAfterLogin': '%2F'
3631
}
3732

38-
MP_DOMAIN = C.URL_MAINTAINANCE_PLANNER.replace('https://', '')
33+
MP_DOMAIN = C.URL_MAINTENANCE_PLANNER.replace('https://', '')
3934
for k, v in mp_cookies.items():
4035
https_session.cookies.set(k, v, domain=MP_DOMAIN, path='/')
4136

@@ -68,7 +63,7 @@ def auth_userapps():
6863

6964

7065
def get_mp_user_details():
71-
url = urljoin(C.URL_MAINTAINANCE_PLANNER,
66+
url = urljoin(C.URL_MAINTENANCE_PLANNER,
7267
'/MCP/MPHomePageController/getUserDetailsDisplay')
7368
params = {'_': int(time.time() * 1000)}
7469
user = _request(url, params=params).json()

plugins/module_utils/sap_launchpad_software_center_catalog_runner.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
#!/user/bin/env python3
2-
# coding: utf-8
3-
41
from . import constants as C
52
from .sap_api_common import _request
6-
from .sap_id_sso import sap_sso_login
73

84

95
def get_software_catalog():

plugins/module_utils/sap_launchpad_software_center_download_runner.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/user/bin/env python3
2-
# coding: utf-8
3-
41
import hashlib
52
import json
63
import logging
@@ -12,7 +9,7 @@
129

1310
from . import constants as C
1411
from .sap_api_common import _request, https_session
15-
from .sap_id_sso import _get_sso_endpoint_meta, sap_sso_login
12+
from .sap_id_sso import _get_sso_endpoint_meta
1613

1714
logger = logging.getLogger(__name__)
1815

plugins/module_utils/sap_launchpad_software_center_download_search_fuzzy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from . import constants as C
77
from .sap_api_common import _request
8-
from .sap_id_sso import sap_sso_login
98

109

1110
def search_software_fuzzy(query, max=None, csv_filename=None):

0 commit comments

Comments
 (0)