Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call super method in EC2AbstractSlave#readResolve() #883

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions src/main/java/hudson/plugins/ec2/EC2AbstractSlave.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,26 +217,27 @@ public EC2AbstractSlave(String name, String instanceId, String templateDescripti

@Override
protected Object readResolve() {
var o = (EC2AbstractSlave) super.readResolve();
/*
* If instanceId is null, this object was deserialized from an old version of the plugin, where this field did
* not exist (prior to version 1.18). In those versions, the node name *was* the instance ID, so we can get it
* from there.
*/
if (instanceId == null) {
instanceId = getNodeName();
if (o.instanceId == null) {
o.instanceId = getNodeName();
}

if (amiType == null) {
amiType = new UnixData(rootCommandPrefix, slaveCommandPrefix, slaveCommandSuffix, Integer.toString(sshPort), null);
if (o.amiType == null) {
o.amiType = new UnixData(o.rootCommandPrefix, o.slaveCommandPrefix, o.slaveCommandSuffix, Integer.toString(o.sshPort), null);
}

if (maxTotalUses == 0) {
if (o.maxTotalUses == 0) {
EC2Cloud cloud = getCloud();
if (cloud != null) {
SlaveTemplate template = cloud.getTemplate(templateDescription);
SlaveTemplate template = cloud.getTemplate(o.templateDescription);
if (template != null) {
if (template.getMaxTotalUses() == -1) {
maxTotalUses = -1;
o.maxTotalUses = -1;
}
}
}
Expand All @@ -248,11 +249,11 @@ protected Object readResolve() {
* made Jenkins entirely unusable for some in the 1.50 release:
* https://issues.jenkins-ci.org/browse/JENKINS-62043
*/
if (terminateScheduled == null) {
terminateScheduled = new ResettableCountDownLatch(1, false);
if (o.terminateScheduled == null) {
o.terminateScheduled = new ResettableCountDownLatch(1, false);
}

return this;
return o;
}

public EC2Cloud getCloud() {
Expand Down
Loading