rubrik-sdk-for-python
rubrik-sdk-for-python copied to clipboard
get_sla_objects skips objects with same name
Expected Behavior .get_sla_objects to return all objects from sla
Current Behavior
returns dictionary of {name:id}. objects with the same name are skipped.
Failure Information (for bugs)
When we have a lot of objects with the same name for example "master" database in mssql_db objects .get_sla_objects appends the results in the dictionary and repeating keys will be overwritten and only objects with unique names get returned.
Steps to Reproduce have 2 objects with same name, (in my case to containers of an mssql database "master"= within the same SLA. query .get_sla_objects , only one "master" object will be returned.
This is happening because it's a dictionary. The keys will be unique. If you're adding new key-value pair to a dictionary which already has the key, it will just update the existing value for that particular key. That's the nature of dictionary.
Well yeah the keys will be unique but you wont be able get them all with this function when you have matching names due to, as you said, nature of dictionary. I rewrote the function for myself using the ID as key so I could get ALL the objects in the SLA not just the ones with a unique name as key.
Yes, every time we need to use the custom function as inverting the kay-values mapping will also result in loss of data.