AWS Thinkbox Discussion Forums

Add slaves programatically to power management group?

I’m trying to add slaves to a powermanagement group and getting the error:

pmanage = RepositoryUtils.GetPowerManagementOptions() pmanage.Groups[0].SlaveNames.append(slavename)

'String[]' object has no attribute 'append'

Also wouldn’t Groups[X] make more sense as a dictionary not a list?

The SlaveNames attribute is a .NET String list, not a Python list. Use .Add()

2015-05-21 10:08:51:  AttributeError: 'String[]' object has no attribute 'Add'

If it’s a .net Array does that mean it’s a static size and can’t be changed?

Oh sorry, yeah, it probably is an array. In that case, I think the only way to modify it would be to resize it and then explicitly set the item at the last index. Alternatively, because the attribute on the PowerManagementGroup is not read-only, you could just replace the whole thing.

I do wonder if changes to that class are actually applied to the repository settings dynamically though, since that would be counter to the way most of the rest of the API works.

Currently, the Power Management settings are read-only when accessed from the API, so changing the SlaveNames in the object won’t be reflected in the database.

It would be possible to add functions to save the power management options, and to load/save the Repository Settings. Maybe we should just do that…

Yes please. And/Or, provide us the option to use Render Groups as Power Management Groups.

Also this is something that you could consider being an autoconfig. The more autoconfig the better IMO. If This Then That kind of stuff on startup.

We’ve added this to our wishlist.

Thanks!
Ryan

Privacy | Site terms | Cookie preferences