I'm working on a major rewrite of the EC2 plugin, trying to take advantage of 
new features that have appeared in Jenkins and improve the code in various ways.

I've run into a problem in this class:
https://github.com/kpfleming/jenkins-aws-plugin/blob/master/src/main/java/org/jenkinsci/plugins/amazonwebservices/cloud/EC2.java

There are two listboxes in the config form for this class; one shows a list of 
IAM credentials (from the Credentials plugin) and one shows a list of EC2 
regions. The second one, based on the 'region' field, requires the first one to 
have a valid value so that it can connect to EC2 and get the list of regions 
available for the selected credentials.

When the form is displayed in the global configuration page, the listboxes 
populate properly, I can select a region, save the form, and the selected 
region is serialized into config.xml as it should be. This is all good.

However, when I reopen the global config page, the region listbox reverts to 
the first entry in the list, even though a different value in present in 
config.xml. When I debug the code, I can see that doFillAwsCredentialsUuidItems 
is called first, then doFillRegionItems is called with an empty (or null) 
parameter, then it is called again with the proper awsCredentialsUuid. Since 
the first call to doFillRegionItems can't obtain a list of regions, it returns 
an empty list, and 'region' loses its value.

What I don't understand is why doFillRegionItems is being called twice; the 
form code knows that it depends on awsCredentialsUuid, and shouldn't be called 
until all processing associated with that field has been completed. Anyone have 
any clues?


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to