sdague / amt

Python tools for interacting with Intel's AMT hardware control interfaces
Apache License 2.0
65 stars 30 forks source link

Using ElementTree to create XML #4

Closed Tan0 closed 9 years ago

Tan0 commented 9 years ago

Support using ElementTree to create XML dynamically. This is a first step. Replace get_request() and power_state_request(), rest of functions are easy to extend.

Tan0 commented 9 years ago

hmmm, looks like client can't pass py34

sdague commented 9 years ago

Can you be more specific about what kind of extending you are planning. I personally find reading the document to be a ton easier than creating the XML dynamically. It's also easier to compare against standards. I'd much rather just add the dynamism that's actually needed here, not prematurely abstract things.

Tan0 commented 9 years ago

Currently, hard code XML is good enough for AMT library. But create XML dynamically is easy to follow AMT Implementation and Reference Guide to extend other features.

For example,enable_remote_kvm could simply follow this guide, get kvmRedirectionSettingDataRef first and change its values properly:

$kvmRedirectionSettingDataRef =$wsmanConnectionObject.NewReference("SELECT * FROM IPS_KVMRedirectionSettingData WHERE InstanceID='Intel(r) KVM Redirection Settings'") $kvmRedirectionSettingDataInstance =$kvmRedirectionSettingDataRef.Get() $kvmRedirectionSettingDataInstance.SetProperty("Is5900PortEnabled","true") $kvmRedirectionSettingDataInstance.SetProperty("RFBPassword","P@ssw0rd") $kvmRedirectionSettingDataRef.Put($kvmRedirectionSettingDataInstance)

sdague commented 9 years ago

Right, honestly, I feel like that doesn't make this easier to understand or use. It was that kind of thing that made me rewrite this in the first place.

I can understand your desire to do something more like that, but I feel like the simple hard coded version is easier to understand for people that don't think in xml.