| A Nullpointer is returned trying to reload updated configuration when the EC2 plugin is configured without the instanceCapStr included. Nullpointer:
java.lang.NullPointerException
at hudson.plugins.ec2.EC2Cloud.<init>(EC2Cloud.java:183)
at hudson.plugins.ec2.AmazonEC2Cloud.<init>(AmazonEC2Cloud.java:72)
Caused: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:141)
Caused: io.jenkins.plugins.casc.ConfiguratorException: amazonEC2: Failed to construct instance of class hudson.plugins.ec2.AmazonEC2Cloud.
Constructor: public hudson.plugins.ec2.AmazonEC2Cloud(java.lang.String,boolean,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.util.List,java.lang.String,java.lang.String).
Arguments: [java.lang.String, java.lang.Boolean, java.lang.String, java.lang.String, java.lang.String, null, null, null, null]
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:149)
Minimum example to reproduce via Config as Code:
jenkins:
clouds:
- amazonEC2:
cloudName: "TestCloud"
#instanceCapStr: ""
privateKey: ""
region: "us-west-2"
useInstanceProfileForCredentials: false
I believe that we just need a null check here: [https://github.com/jenkinsci/ec2-plugin /blob/7aae12427c40c15a020ca445cffe6c812113ecce/src/main/java/hudson/plugins/ec2/EC2Cloud.java#L185] or instanceCapStr.isEmpty() Might want to update the demo example as well. It may be helpful, related to the recently closed Windows EC2 Slave issue, to include an example with user_data. That's unrelated to this request though. |