python-hpilo icon indicating copy to clipboard operation
python-hpilo copied to clipboard

Allow "*_priv" vars in mod_dir_config to be single digit

Open bb-Ricardo opened this issue 6 years ago • 10 comments

Currently the privileges in mod_dir_config need to be comma separated to be accepted. This will not work for single privileges like "1" or "6".

This commit fixes this.

bb-Ricardo avatar Mar 03 '20 13:03 bb-Ricardo

Any reason this why this hasn't been merged? The other two PR got merged except this one.

Thank you

bb-Ricardo avatar Nov 24 '20 12:11 bb-Ricardo

Must have missed it, sorry!

seveas avatar Nov 25 '20 08:11 seveas

Finally getting around to looking at this properly, and I think it's all wrong and the old code works just fine

If you pass "1", the split turns it into ["1"], and the join turns it back into "1", so it does what it needs to do. Can you tell me what you're actually passing as argument, and how what the old code does is wrong? Maybe then I'll understand better what you're trying to achieve.

seveas avatar Jan 16 '21 14:01 seveas

Hi, what I do: Get the data from ILO as json, manipulate one attribute and sending the whole json back.

This didn't work. With this change it fixed it.

bb-Ricardo avatar Jan 16 '21 14:01 bb-Ricardo

What was the value you changed it to?

seveas avatar Jan 16 '21 14:01 seveas

Just "6" as single privilege. And it's not an list so it cant iterate over it. Und just "6" should be valid.

bb-Ricardo avatar Jan 16 '21 14:01 bb-Ricardo

It should be, and is valid. The old code will turn that "6" into ["6"] in the split, and then that ["6"] back into a "6" in the join. Can you run the old code in debug mode (setting the debug attribute of the ilo isntance, or passing --debug to hpilo_cli) and share the output. I have a sneaky suspicion it's not your "6" that's the problem, but something else returned by the iLO. I'd also like to see which error you're getting.

seveas avatar Jan 16 '21 14:01 seveas

Will be able to do that next week. Can only test it at work.

bb-Ricardo avatar Jan 16 '21 15:01 bb-Ricardo

I figured out what the actual issue is: the xml parser magic turns the privileges you get from the ilo into integers and not single-digit strings. So when you feed those back in, those are the ones that are not iterable (strings are iterable just fine). 728c085 fixes it.

seveas avatar Jan 16 '21 15:01 seveas

Yes, this sounds like the issue I had. Was so long ago that I had trouble remembering what the actual problem was.

Thanks for fixing it.

bb-Ricardo avatar Jan 16 '21 17:01 bb-Ricardo