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

Add networking interface information to support bundle #24

Merged
merged 13 commits into from Jun 9, 2015

Conversation

Projects
None yet
4 participants
@christ66
Member

christ66 commented Feb 25, 2015

Add an option to obtain information about the networking interfaces that are part of the computer.

@reviewbybees

byte[] hardwareAddress = ni.getHardwareAddress();
// Do not have permissions or address does not exist
if (hardwareAddress == null || hardwareAddress.length == 0)

This comment has been minimized.

@jtnord

jtnord Feb 25, 2015

Member

As jenkins may only be bound to the loopback I think we should not break but just not dump the hardware address (or dump something special)

pw.println(" ** Hardware Address - " + Util.toHexString(hardwareAddress));
pw.println(" ** Index - " + ni.getIndex());
pw.println(" ** Inet Address - " + ni.getInetAddresses());

This comment has been minimized.

@jtnord

jtnord Feb 25, 2015

Member

This is an array so prints an object :(

** Inet Address - java.net.NetworkInterface$1checkedAddresses@2ce6ab88

private static final class GetNetworkInterfaces implements Callable<String, RuntimeException> {
public String call() {
StringWriter bos = new StringWriter();

This comment has been minimized.

@jtnord

jtnord Feb 25, 2015

Member

seems like an overkill when StringBuilder would work.

@jenkinsadmin

This comment has been minimized.

Member

jenkinsadmin commented Feb 26, 2015

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

bos.append(" ** Index - ").append(ni.getIndex()).append("\n");
Enumeration<InetAddress> inetAddresses = ni.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();

This comment has been minimized.

@jtnord

jtnord Jun 8, 2015

Member

I think you mean to refer to inetAddress here.

@jtnord

This comment has been minimized.

Member

jtnord commented Jun 8, 2015

👎 also build failure needs investigating.

@christ66

This comment has been minimized.

Member

christ66 commented Jun 8, 2015

@jtnord Fixed.

new Content("nodes/master/networkInterface.md") {
@Override
public void writeTo(OutputStream os) throws IOException {
os.write(getNetworkInterface(Jenkins.getInstance()).getBytes("utf-8"));

This comment has been minimized.

@jtnord

jtnord Jun 8, 2015

Member

"utf-8" is implementation specific. Use the mandated "UTF-8" instead.

new Content("nodes/slave/" + node.getNodeName() + "/networkInterface.md") {
@Override
public void writeTo(OutputStream os) throws IOException {
os.write(getNetworkInterface(node).getBytes("utf-8"));

This comment has been minimized.

@jtnord

jtnord Jun 8, 2015

Member

ditto above.

new Content("nodes/master/networkInterface.md") {
@Override
public void writeTo(OutputStream os) throws IOException {
os.write(getNetworkInterface(Jenkins.getInstance()).getBytes("UTF-8"));

This comment has been minimized.

@jglick

jglick Jun 8, 2015

Member

BTW there are at least two UTF_8 constants: Apache Commons and Guava.

This comment has been minimized.

@jtnord

jtnord Jun 9, 2015

Member

I wouldn't use either of those and wait until JDK7 and use StandardCharsets which is even more efficient :-)

@jglick

This comment has been minimized.

Member

jglick commented Jun 8, 2015

👍

1 similar comment
@jtnord

This comment has been minimized.

Member

jtnord commented Jun 9, 2015

👍

christ66 added a commit that referenced this pull request Jun 9, 2015

Merge pull request #24 from christ66/network
Add networking interface information to support bundle

@christ66 christ66 merged commit 62e67ad into jenkinsci:master Jun 9, 2015

1 check passed

Jenkins This pull request looks good
Details

@christ66 christ66 deleted the christ66:network branch Jun 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment