-
Bug
-
Resolution: Fixed
-
Minor
-
-
EC2 Plugin 1.44
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 (uncomment the instanceCapStr and it will reload successfully):
jenkins: clouds: - amazonEC2: cloudName: "TestCloud" #instanceCapStr: "" privateKey: "" region: "us-west-2" remoteFS: "c:\\jenkins" 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 if it helps clarify for any required fields. It may be helpful, related to the recently closed Windows EC2 Slave issue, to include an example of a Windows slave with user_data. That's unrelated to this request though.
EDIT: I've just noticed that I'm also getting a nullpointer when I do not specify the remoteFS: "c:
jenkins" via CasC as well. I've updated the above example to include it. I received the following exception right after winrm connects and the temp directory is created if it doesn't exist:
java.lang.NullPointerException at hudson.Util.isRelativePath(Util.java:557) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:642) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:432) at hudson.plugins.ec2.win.EC2WindowsLauncher.launchScript(EC2WindowsLauncher.java:76) at hudson.plugins.ec2.EC2ComputerLauncher.launch(EC2ComputerLauncher.java:48) at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:294) at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46) at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
- is duplicated by
-
JENKINS-57562 EC2Cloud crashes with NPE when instanceCapStr is not passed from JCasC
- Resolved