Skip to content

Commit

Permalink
align headers, clean up imports & fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Winzeler committed Nov 17, 2023
1 parent 54cb667 commit 4a8245e
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 29 deletions.
4 changes: 2 additions & 2 deletions plugins/module_utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
URL_SERVICE_INCIDENT = 'https://launchpad.support.sap.com/services/odata/incidentws'
URL_SERVICE_USER_ADMIN = 'https://launchpad.support.sap.com/services/odata/useradminsrv'
URL_SOFTWARE_DOWNLOAD = 'https://softwaredownloads.sap.com'
# Maintainance Planner
URL_MAINTAINANCE_PLANNER = 'https://maintenanceplanner.cfapps.eu10.hana.ondemand.com'
# Maintenance Planner
URL_MAINTENANCE_PLANNER = 'https://maintenanceplanner.cfapps.eu10.hana.ondemand.com'
URL_USERAPPS = 'https://userapps.support.sap.com/sap/support/mp/index.html'
URL_USERAPP_MP_SERVICE = 'https://userapps.support.sap.com/sap/support/mnp/services'
URL_LEGACY_MP_API = 'https://tech.support.sap.com/sap/support/mnp/services'
Expand Down
3 changes: 0 additions & 3 deletions plugins/module_utils/sap_api_common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# coding: utf-8

import logging
import re
from urllib.parse import urlparse
Expand Down
3 changes: 0 additions & 3 deletions plugins/module_utils/sap_id_sso.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python3
# coding: utf-8

import json
import logging
import re
Expand Down
13 changes: 4 additions & 9 deletions plugins/module_utils/sap_launchpad_maintenance_planner_runner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/user/bin/env python3
# coding: utf-8

import os
import pathlib
import re
import time
Expand All @@ -11,11 +7,10 @@
from bs4 import BeautifulSoup
from lxml import etree
from requests.auth import HTTPBasicAuth
from requests.sessions import session

from . import constants as C
from .sap_api_common import _request, https_session
from .sap_id_sso import _get_sso_endpoint_meta, sap_sso_login
from .sap_id_sso import _get_sso_endpoint_meta

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

Expand All @@ -35,7 +30,7 @@ def auth_maintenance_planner():
'locationAfterLogin': '%2F'
}

MP_DOMAIN = C.URL_MAINTAINANCE_PLANNER.replace('https://', '')
MP_DOMAIN = C.URL_MAINTENANCE_PLANNER.replace('https://', '')
for k, v in mp_cookies.items():
https_session.cookies.set(k, v, domain=MP_DOMAIN, path='/')

Expand Down Expand Up @@ -68,7 +63,7 @@ def auth_userapps():


def get_mp_user_details():
url = urljoin(C.URL_MAINTAINANCE_PLANNER,
url = urljoin(C.URL_MAINTENANCE_PLANNER,
'/MCP/MPHomePageController/getUserDetailsDisplay')
params = {'_': int(time.time() * 1000)}
user = _request(url, params=params).json()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/user/bin/env python3
# coding: utf-8

from . import constants as C
from .sap_api_common import _request
from .sap_id_sso import sap_sso_login


def get_software_catalog():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/user/bin/env python3
# coding: utf-8

import hashlib
import json
import logging
Expand All @@ -12,7 +9,7 @@

from . import constants as C
from .sap_api_common import _request, https_session
from .sap_id_sso import _get_sso_endpoint_meta, sap_sso_login
from .sap_id_sso import _get_sso_endpoint_meta

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from . import constants as C
from .sap_api_common import _request
from .sap_id_sso import sap_sso_login


def search_software_fuzzy(query, max=None, csv_filename=None):
Expand Down
3 changes: 2 additions & 1 deletion plugins/modules/maintenance_planner_files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3

# SAP Maintenance Planner files retrieval

Expand Down Expand Up @@ -69,6 +69,7 @@
from ..module_utils.sap_launchpad_maintenance_planner_runner import *
from ..module_utils.sap_launchpad_software_center_download_runner import \
is_download_link_available
from ..module_utils.sap_id_sso import sap_sso_login


def run_module():
Expand Down
3 changes: 2 additions & 1 deletion plugins/modules/maintenance_planner_stack_xml_download.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3

# SAP Maintenance Planner Stack XML download

Expand Down Expand Up @@ -69,6 +69,7 @@

# Import runner
from ..module_utils.sap_launchpad_maintenance_planner_runner import *
from ..module_utils.sap_id_sso import sap_sso_login


def run_module():
Expand Down
3 changes: 2 additions & 1 deletion plugins/modules/software_center_download.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3

# SAP software download module

Expand Down Expand Up @@ -88,6 +88,7 @@

# Import runner
from ..module_utils.sap_launchpad_software_center_download_runner import *
from ..module_utils.sap_id_sso import sap_sso_login


def run_module():
Expand Down

0 comments on commit 4a8245e

Please sign in to comment.