Skip to content

Commit

Permalink
RHINENG-2450 Remove logic about the old SAP-related fields
Browse files Browse the repository at this point in the history
The old SAP-related fields[1] will be removed in favor of the "sap"
object[2]. Thus, this PR addresses RHINENG-2450.

For information, the pull request removing these old fields is [3][RHINENG-2286].

[1] - https://github.com/RedHatInsights/inventory-schemas/blob/master/schemas/system_profile/v1.yaml#L511-L534
[2] - https://github.com/RedHatInsights/inventory-schemas/blob/master/schemas/system_profile/v1.yaml#L483-L510
[3] - RedHatInsights/inventory-schemas#119

Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
  • Loading branch information
strider committed Oct 10, 2023
1 parent aa0a136 commit e0e4574
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
19 changes: 6 additions & 13 deletions src/puptoo/process/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,30 +278,23 @@ def system_profile(

if sap:
try:
profile["sap_system"] = True
profile["sap"] = {}
profile["sap"]["sap_system"] = True
sids = {sap.sid(instance) for instance in sap.local_instances}
profile["sap_sids"] = sorted(list(sids))
profile["sap"]["sids"] = sorted(list(sids))
if sap.local_instances:
inst = sap.local_instances[0]
profile["sap_instance_number"] = sap[inst].number
profile["sap"] = {}
profile["sap"]["sap_system"] = profile.get("sap_system")
if profile.get("sap_sids"):
profile["sap"]["sids"] = profile.get("sap_sids")
if profile.get("sap_instance_number"):
profile["sap"]["instance_number"] = profile.get("sap_instance_number")
profile["sap"]["instance_number"] = sap[inst].number
except Exception as e:
catch_error("sap", e)
raise

if hdb_version:
try:
if type(hdb_version) == list:
profile["sap_version"] = hdb_version[0].version
profile["sap"]["version"] = hdb_version[0].version
else:
profile["sap_version"] = hdb_version.version
if profile.get("sap"):
profile["sap"]["version"] = profile["sap_version"]
profile["sap"]["version"] = hdb_version.version
except Exception as e:
catch_error("hdb_version", e)
raise
Expand Down
11 changes: 1 addition & 10 deletions tests/test_sap.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@ def test_sap():
input_data.add(Specs.saphostctl_getcimobject_sapinstance, SAP_DATA)
input_data.add(Specs.hostname, HOSTNAME)
result = run_test(system_profile, input_data)

expected_sap_object = {'instance_number': '88', 'sap_system': True, 'sids': ['D89']}
assert result["sap_system"] == True
assert result["sap_instance_number"] == '88'
assert result["sap_sids"] == ['D89']
assert result["sap"] == expected_sap_object


Expand All @@ -60,10 +57,4 @@ def test_sap():
result = run_test(system_profile, input_data)

expected_sap_object = {'sap_system': True}
assert result["sap_system"] == True
assert result.get("sap_instance_number") == None
assert result.get("sap_sids") == None
assert result["sap"] == expected_sap_object



0 comments on commit e0e4574

Please sign in to comment.