Closed xmonader closed 4 years ago
Enums currently are being compared by their value which can differ in different schemas depending on the order in the options list.
in the mentioned case the enum definition in the package schema is
status = "init,config,toinstall,installed,tostart,disabled,error" (E)
and in schema_in for the actor
status = "all,init,config,toinstall,installed,tostart,disabled,error" (E)
notice that a new option (all) added in the schema in so for example the value for "init" is (1) in the first schema and (2) in the other one
in __eq__
method in Enum objects we can compare by the string representation of the enum instead of the value
is this an acceptable solution ?
yes, string comparison ok
verified on development run the enums tests and worked successfully
this was required to fix the comparison, but this means it might be broken in other code
https://github.com/threefoldtech/jumpscaleX_threebot/blob/489ce1ec0ab36a1f3e24835559ef0d0bb4266694/ThreeBotPackages/zerobot/packagemanager/actors/package_manager.py#L181