Search in sources :

Example 1 with SystemPlatform

use of com.cloudbees.jenkins.support.util.SystemPlatform in project support-core-plugin by jenkinsci.

the class AdvancedProcFilesRetriever method addUnixContents.

@Override
protected void addUnixContents(@NonNull Container container, @NonNull final Node node) {
    Computer c = node.toComputer();
    if (c == null || c.isOffline()) {
        return;
    }
    // fast path bailout for Windows
    if (!Boolean.TRUE.equals(c.isUnix())) {
        return;
    }
    SystemPlatform nodeSystemPlatform = getSystemPlatform(node);
    if (!SystemPlatform.LINUX.equals(nodeSystemPlatform)) {
        return;
    }
    String name;
    if (node instanceof Jenkins) {
        name = "master";
    } else {
        name = "slave/" + node.getNodeName();
    }
    for (ProcFile procDescriptor : getProcFilesToRetrieve()) {
        container.add(new FilePathContent("nodes/{0}/proc/{1}", new String[] { name, procDescriptor.getName() }, new FilePath(c.getChannel(), procDescriptor.getFile())) {

            @Override
            public boolean shouldBeFiltered() {
                // Whether this specific file should be filtered or not
                return procDescriptor.isFiltered();
            }
        });
    }
    afterAddUnixContents(container, node, name);
}
Also used : Jenkins(jenkins.model.Jenkins) FilePath(hudson.FilePath) FilePathContent(com.cloudbees.jenkins.support.api.FilePathContent) Computer(hudson.model.Computer) SystemPlatform(com.cloudbees.jenkins.support.util.SystemPlatform)

Example 2 with SystemPlatform

use of com.cloudbees.jenkins.support.util.SystemPlatform in project support-core-plugin by jenkinsci.

the class ProcFilesRetriever method addUnixContents.

protected void addUnixContents(@NonNull Container container, @NonNull final Node node) {
    Computer c = node.toComputer();
    if (c == null || c.isOffline()) {
        return;
    }
    // fast path bailout for Windows
    if (!Boolean.TRUE.equals(c.isUnix())) {
        return;
    }
    SystemPlatform nodeSystemPlatform = getSystemPlatform(node);
    if (!SystemPlatform.LINUX.equals(nodeSystemPlatform)) {
        return;
    }
    String name;
    if (node instanceof Jenkins) {
        name = "master";
    } else {
        name = "slave/" + node.getNodeName();
    }
    for (Map.Entry<String, String> procDescriptor : getFilesToRetrieve().entrySet()) {
        container.add(new FilePathContent("nodes/{0}/proc/{1}", new String[] { name, procDescriptor.getValue() }, new FilePath(c.getChannel(), procDescriptor.getKey())));
    }
    afterAddUnixContents(container, node, name);
}
Also used : Jenkins(jenkins.model.Jenkins) FilePath(hudson.FilePath) FilePathContent(com.cloudbees.jenkins.support.api.FilePathContent) Computer(hudson.model.Computer) SystemPlatform(com.cloudbees.jenkins.support.util.SystemPlatform) Map(java.util.Map) WeakHashMap(java.util.WeakHashMap)

Aggregations

FilePathContent (com.cloudbees.jenkins.support.api.FilePathContent)2 SystemPlatform (com.cloudbees.jenkins.support.util.SystemPlatform)2 FilePath (hudson.FilePath)2 Computer (hudson.model.Computer)2 Jenkins (jenkins.model.Jenkins)2 Map (java.util.Map)1 WeakHashMap (java.util.WeakHashMap)1