Hi Thomas, Am Freitag, dem 03.01.2025 um 09:58 +0100 schrieb Thomas Goirand: > On 1/1/25 19:56, Daniel Leidert wrote:
[..]
> > ilorest (5.2.0.0-4) wird eingerichtet ...
> > File "/usr/lib/python3/dist-
> > packages/ilorest/extensions/iLO_COMMANDS/EthernetCommand.py", line
> > 577
> > ["UseNTPServers"] = True
> > ^^^^^^^^^^^^^^^
> > SyntaxError: cannot assign to literal
> > File "/usr/lib/python3/dist-
> > packages/ilorest/extensions/iLO_COMMANDS/EthernetCommand.py", line
> > 577
> > ["UseNTPServers"] = True
> > ^^^^^^^^^^^^^^^
> > SyntaxError: cannot assign to literal
> > dpkg: Fehler beim Bearbeiten des Paketes ilorest (--configure):
>
> Indeed, as I reverted my patch that broke things. I am currently unsure
> how to fix this one, help would be appreciated.
I think, the original code contains a bug:
data[eth_config_type][_path]["Oem"]
[self.rdmc.app.typepath.defs.oemhp]["DHCPv4"][
"UseNTPServers"
] = True
The first and the second line get separated here and make two
statements instead of one. And the second stament receives the warning.
But that's not what the authors actually try to do, as shown a few
lines below, where it says:
data[eth_config_type][_path]["Oem"][self.rdmc.app.typepath.defs.oemhp][
"DHCPv4"
]["UseNTPServers"] = True
Within the [], line continuation sets in despite the newlines, making
this a single statement. In your patch, you basically create a similar
situation by creating the single statment:
["UseNTPServers"] = True
that leads to the error. I think you discovered a real bug here. A
simple fix is attached. IMO you could also fix it by removing all
newlines in the statement and make it a one-liner:
data[eth_config_type][_path]["Oem"][self.rdmc.app.typepath.defs.oemhp["DHCPv4"]["UseNTPServers"]
= True
I attached a revised patch.
Regards, Daniel
Description: Fix syntax warning Author: Thomas Goirand <[email protected]> Bug: https://github.com/HewlettPackard/python-redfish-utility/issues/107 Bug-Debian: https://bugs.debian.org/1085642 Forwarded: no Last-Update: 2024-12-03 --- a/ilorest/extensions/iLO_COMMANDS/EthernetCommand.py +++ b/ilorest/extensions/iLO_COMMANDS/EthernetCommand.py @@ -572,14 +572,12 @@ try: data[eth_config_type][_path]["DHCPv4"]["UseNTPServers"] = True data[eth_config_type][_path]["DHCPv6"]["UseNTPServers"] = True - data[eth_config_type][_path]["Oem"] - [self.rdmc.app.typepath.defs.oemhp]["DHCPv4"][ - "UseNTPServers" - ] = True - data[eth_config_type][_path]["Oem"] - [self.rdmc.app.typepath.defs.oemhp]["DHCPv6"][ - "UseNTPServers" - ] = True + data[eth_config_type][_path]["Oem"][self.rdmc.app.typepath.defs.oemhp][ + "DHCPv4" + ]["UseNTPServers"] = True + data[eth_config_type][_path]["Oem"][self.rdmc.app.typepath.defs.oemhp][ + "DHCPv6" + ]["UseNTPServers"] = True self.load_ethernet_aux( eth_config_type, _path,
signature.asc
Description: This is a digitally signed message part

