Skip to content

Commit 86a9386

Browse files
committed
version 6.2.0.0
1 parent 82d7ae4 commit 86a9386

File tree

5 files changed

+53
-14
lines changed

5 files changed

+53
-14
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
extras = {}
44

55
setup(name='python-ilorest-library',
6-
version='6.1.0.0',
6+
version='6.2.0.0',
77
description='iLO Rest Python Library',
88
author='Hewlett Packard Enterprise',
99
author_email='[email protected]',

src/redfish/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
""" Redfish restful library """
22

33
__all__ = ["rest", "ris", "hpilo"]
4-
__version__ = "6.1.0.0"
4+
__version__ = "6.2.0.0"
55

66
import logging
77

src/redfish/hpilo/risblobstore2.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ def __init__(self, log_dir=None):
176176
def __del__(self):
177177
"""Blob store 2 close channel function"""
178178
if hasattr(self, "channel"):
179-
LOGGER.info("Closing BlobStore channel.")
180179
self.channel.close()
181180

182181
def create(self, key, namespace):
@@ -492,8 +491,8 @@ def write_fragment(self, key, namespace, data=None, offset=0, count=1):
492491

493492
dataarr = bytearray(sendpacket)
494493
dataarr.extend(memoryview(data))
495-
496-
LOGGER.debug(f"Data to be sent: {dataarr[:50]}... (first 50 bytes)")
494+
LOGGER.debug(f"Data ready to be sent...")
495+
#LOGGER.debug(f"Data to be sent: {dataarr[:50]}... (first 50 bytes)")
497496

498497
# Send the data
499498
try:

src/redfish/hpilo/rishpilo.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ def chif_packet_exchange(self, data):
167167
"""
168168
LOGGER.info("Starting chif packet exchange...")
169169

170-
# Log the data being sent (truncated if necessary for large data)
171-
LOGGER.debug(f"Data to be sent: {data[:50]}... (first 50 bytes)")
170+
LOGGER.debug(f"Data ready to be sent...")
171+
#LOGGER.debug(f"Data to be sent: {data[:50]}... (first 50 bytes)")
172172

173173
datarecv = self.dll.get_max_buffer_size()
174174
buff = create_string_buffer(bytes(data))
@@ -198,7 +198,8 @@ def chif_packet_exchange(self, data):
198198
pkt = bytearray(recbuff[:])
199199
else:
200200
pkt = bytearray(recbuff[:datarecv])
201-
LOGGER.debug(f"Received data: {pkt[:50]}... (first 50 bytes)")
201+
LOGGER.debug(f"Received data...")
202+
#LOGGER.debug(f"Received data: {pkt[:50]}... (first 50 bytes)")
202203

203204
return pkt
204205

@@ -215,7 +216,7 @@ def send_receive_raw(self, data, retries=10):
215216
sequence = struct.unpack("<H", bytes(data[2:4]))[0]
216217

217218
if LOGGER.isEnabledFor(logging.DEBUG):
218-
LOGGER.debug("Sending data: %s, retries: %d, initial sequence: %d", data, retries, sequence)
219+
LOGGER.debug("Retries: %d, Initial sequence: %d", retries, sequence)
219220

220221
while tries < retries:
221222
try:
@@ -226,7 +227,7 @@ def send_receive_raw(self, data, retries=10):
226227

227228
# Log the response data for debugging (consider limiting if large)
228229
if LOGGER.isEnabledFor(logging.DEBUG):
229-
LOGGER.debug("Received response: %s", resp)
230+
LOGGER.debug("Received response...")
230231

231232
# Check for matching sequence
232233
received_sequence = struct.unpack("<H", bytes(resp[2:4]))[0]

src/redfish/ris/ris.py

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,42 @@ def capture(self, redmono=False, single=True):
11761176
ret = {}
11771177
return ret
11781178

1179+
def normalize_urls(self, data):
1180+
"""
1181+
Normalize URL-like dictionary keys:
1182+
- If both '/path' and '/path/' exist, keep only '/path/'.
1183+
- If only one version exists, ensure the key ends with '/'.
1184+
- All final keys end with '/'.
1185+
"""
1186+
normalized_data = {}
1187+
seen = set()
1188+
1189+
for key in data:
1190+
# Normalize key with trailing slash
1191+
if key.endswith("/"):
1192+
base_key = key[:-1]
1193+
trailing_key = key
1194+
else:
1195+
base_key = key
1196+
trailing_key = key + "/"
1197+
1198+
# Avoid processing the same base path twice
1199+
if base_key in seen:
1200+
continue
1201+
seen.add(base_key)
1202+
1203+
# Prefer version with trailing slash
1204+
if trailing_key in data:
1205+
normalized_data[trailing_key] = data[trailing_key]
1206+
elif base_key in data:
1207+
normalized_data[trailing_key] = data[base_key]
1208+
1209+
return normalized_data
1210+
1211+
def fetch_data(self, path):
1212+
resp = self.client.get(path)
1213+
return resp
1214+
11791215
def captureallconfig(self, single=True, exclueurl=None):
11801216
"""Crawls the server and returns the monolith data or just headers and responses.
11811217
@@ -1191,14 +1227,17 @@ def captureallconfig(self, single=True, exclueurl=None):
11911227

11921228
try:
11931229
for x, v in self.paths.items():
1194-
if exclueurl.lower() not in x.lower():
1230+
if exclueurl.lower() != x.lower():
11951231
if v:
1196-
v_resp = v.resp
1197-
if v_resp:
1198-
ret[x] = {"Headers": v_resp.getheaders(), "Response": v_resp.dict}
1232+
if v.resp is not None:
1233+
ret[x] = {"Headers": v.resp.getheaders(), "Response": v.resp.dict}
1234+
else:
1235+
resp = self.fetch_data(x)
1236+
ret[x] = {"Headers": resp.getheaders(), "Response": resp.dict}
11991237
except Exception as e:
12001238
LOGGER.debug("Error in capture: %s", e)
12011239
ret = {}
1240+
ret = self.normalize_urls(ret)
12021241
return ret
12031242

12041243
def killthreads(self):

0 commit comments

Comments
 (0)