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

Add output for port/protocol for host resource. #2202

Merged
merged 3 commits into from
Oct 4, 2017

Conversation

jquick
Copy link
Contributor

@jquick jquick commented Oct 2, 2017

This fixes #2085. Port and protocol are now shown in output of the host resource if defined.

issue-2085

@jquick jquick requested a review from a team as a code owner October 2, 2017 20:37
@jquick jquick force-pushed the jq/host-add-port-to-output branch from fac668b to e7b136e Compare October 2, 2017 20:45
@jquick jquick changed the title Added output for port/protocol for host resource. Add output for port/protocol for host resource. Oct 3, 2017
This fixes #2085. Port and protocol are now shown in output of the host
resource if defined.

Signed-off-by: Jared Quick <[email protected]>
@jquick jquick force-pushed the jq/host-add-port-to-output branch from 61271c3 to 29c384e Compare October 3, 2017 18:51
Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, @jquick! My suggestion isn't a blocker but would avoid an early return. Thanks for the fix!

@@ -113,6 +113,7 @@ def ipaddress
end

def to_s
return "Host #{hostname} port #{port} proto #{protocol}" if port
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine. I'd consider "building" the string instead of the early return so we're not duplicating the "Host hostname" bit... something like this:

def to_s
  resource_name = "Host #{hostname}"
  resource_name += " port #{port} proto #{protocol}" if port

  resource_name
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, just pushed out a update with the changes. Thanks for the help!

@adamleff adamleff added the Type: Enhancement Improves an existing feature label Oct 4, 2017
@jquick jquick force-pushed the jq/host-add-port-to-output branch from 8cc993b to 4a3ef8c Compare October 4, 2017 19:00
Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, and tests are all green!

@adamleff adamleff requested a review from a team October 4, 2017 19:11
Copy link
Contributor

@arlimus arlimus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jquick !! 😁

@arlimus arlimus merged commit 01d9749 into master Oct 4, 2017
@arlimus arlimus deleted the jq/host-add-port-to-output branch October 4, 2017 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improves an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

describe host(...) output
4 participants