Skip to content

Commit f16df02

Browse files
committed
Fix warnings for deprecated methods
1 parent 4d6909a commit f16df02

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloud.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private boolean canProvisionSlaveTemplate(@Nonnull ScriptedCloudSlaveTemplate te
123123
}
124124

125125
private int getTemplateInstancesCount(@Nonnull ScriptedCloudSlaveTemplate template) {
126-
Computer[] computers = Jenkins.getInstance().getComputers();
126+
Computer[] computers = Jenkins.get().getComputers();
127127

128128
int count = 0;
129129
for (Computer computer : computers){
@@ -138,7 +138,7 @@ private int getTemplateInstancesCount(@Nonnull ScriptedCloudSlaveTemplate templa
138138
}
139139

140140
private int getInstancesCount() {
141-
Computer[] computers = Jenkins.getInstance().getComputers();
141+
Computer[] computers = Jenkins.get().getComputers();
142142

143143
int count = 0;
144144
for (Computer computer : computers){
@@ -188,7 +188,7 @@ public Node call() throws Exception {
188188
template.getSecToWaitOnline(),
189189
template.getReusable());
190190

191-
Jenkins.getInstance().addNode(slave);
191+
Jenkins.get().addNode(slave);
192192

193193

194194
LOGGER.log(Level.INFO, String.format("Asking ScriptedCloud %s to schedule new Jenkins slave %s", name, slaveName));
@@ -284,11 +284,11 @@ private void executeCommand(String command, String name, List<EnvironmentVariabl
284284
environmentVariables.forEach(ev -> envVars.put(ev.getKey(), ev.getValue()));
285285

286286
envVars.put("SLAVE_NAME", name);
287-
envVars.put("JENKINS_URL", Jenkins.getInstance().getRootUrl());
287+
envVars.put("JENKINS_URL", Jenkins.get().getRootUrl());
288288

289289
// Support for Jenkins security
290-
if (Jenkins.getInstance().isUseSecurity()) {
291-
envVars.put("JNLP_SECRET", jenkins.slaves.JnlpSlaveAgentProtocol.SLAVE_SECRET.mac(name));
290+
if (Jenkins.get().isUseSecurity()) {
291+
envVars.put("JNLP_SECRET", jenkins.slaves.JnlpAgentReceiver.SLAVE_SECRET.mac(name));
292292
}
293293

294294

src/main/java/org/jenkinsci/plugins/scripted_cloud/ScriptedCloudSlave.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ public ScriptedCloudSlave(String name, String nodeDescription,
5454
List<? extends NodeProperty<?>> nodeProperties,
5555
String cloudName, List<EnvironmentVariable> envVars,
5656
String secToWaitOnline, Boolean reusable) throws FormException, IOException {
57-
super(name, nodeDescription, remoteFS, numExecutors, mode, labelString,
58-
new ScriptedCloudLauncher(delegateLauncher, Util.tryParseNumber(secToWaitOnline, 10 * 60).intValue())
59-
, retentionStrategy, nodeProperties);
57+
super(name, remoteFS, new ScriptedCloudLauncher(delegateLauncher, Util.tryParseNumber(secToWaitOnline, 10 * 60).intValue()) );
6058

6159
this.cloudName = cloudName;
6260
this.reusable = reusable;
@@ -82,7 +80,7 @@ public String getCloudName() {
8280
}
8381

8482
public Cloud getCloud() {
85-
return Jenkins.getInstance().getCloud(getCloudName());
83+
return Jenkins.get().getCloud(getCloudName());
8684
}
8785

8886
public String getSecToWaitOnline() {
@@ -101,7 +99,7 @@ public int getSecToWaitOnlineInt(){
10199
*/
102100
@Nonnull
103101
public ScriptedCloud getScriptedCloud() {
104-
Cloud cloud = Jenkins.getInstance().getCloud(getCloudName());
102+
Cloud cloud = Jenkins.get().getCloud(getCloudName());
105103
if (cloud instanceof ScriptedCloud) {
106104
return (ScriptedCloud) cloud;
107105
} else {
@@ -248,7 +246,7 @@ public boolean configure(StaplerRequest req, JSONObject o)
248246

249247
public List<ScriptedCloud> getScriptedClouds() {
250248
List<ScriptedCloud> result = new ArrayList<ScriptedCloud>();
251-
for (Cloud cloud : Jenkins.getInstance().clouds) {
249+
for (Cloud cloud : Jenkins.get().clouds) {
252250
if (cloud instanceof ScriptedCloud) {
253251
result.add((ScriptedCloud) cloud);
254252
}

0 commit comments

Comments
 (0)