Skip to content

Commit

Permalink
updated installPlugins() so we don't execute the install method if th…
Browse files Browse the repository at this point in the history
…ere is no plugins to install
  • Loading branch information
kryptag committed Nov 10, 2017
1 parent c673d38 commit 6cae804
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import hudson.PluginManager;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
import hudson.lifecycle.RestartNotSupportedException;
import hudson.model.Descriptor;
import jenkins.model.Jenkins;
import org.yaml.snakeyaml.Yaml;
Expand Down Expand Up @@ -134,7 +135,7 @@ private void document(String name, Set<Attribute> attributes) {
}

@Initializer(after = InitMilestone.JOB_LOADED)
public static void installPlugins() throws IOException {
public static void installPlugins() throws IOException, RestartNotSupportedException {
// TODO get version added to the install of the plugin so we can control the specific version
ArrayList<String> p = new ArrayList<>();
PluginManager pluginManager = Jenkins.getInstance().pluginManager;
Expand All @@ -145,9 +146,9 @@ public static void installPlugins() throws IOException {
p.add(sn);
}
}

pluginManager.install(p, false);

if (!p.isEmpty()) {
pluginManager.install(p, false);
}
}

private static <T> T getConfigYaml(File file, Class<T> type) throws FileNotFoundException {
Expand Down

0 comments on commit 6cae804

Please sign in to comment.