-
Notifications
You must be signed in to change notification settings - Fork 448
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 getHostByName function to resolve dns names to ips #173
Conversation
Any chance I get feedback on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, in the future if more network functions are created the file for them should be renamed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two pieces of feedback:
- Can you name the file
network.go
andnetwork_test.go
- Can you update the documentation to include this function
Thanks for the feedback!! Done! |
docs/network.md
Outdated
@@ -0,0 +1,11 @@ | |||
# Network Functions | |||
|
|||
Sprig has a number of string manipulation functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a copy and paste error. This is the network functions not the string ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry dude, I'll fix it
network.go
Outdated
"net" | ||
) | ||
|
||
func getHostByName(name string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry I didn't catch this before but returning an error has some consequences. It stops execution of the template where it is at and returns an error from Execute
. You can see an example with this function at https://play.golang.org/p/d1f0BridbDc.
For sprig v3 we are going to add error handling via #132 and expanding it to cover any others.
Would you mind ignoring the error for now and we'll add that back when we have a consistent setup for both with and without error handling at that level.
For what it's worth, v3 is coming this month.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure no problem at all!! :). I'll ignore the error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove error catching from the test as well
@mattfarina it seems one of the build steps failed due to a connectivity issue towards git.luolix.topm can we re-trigger the job? I didn't find the way to do it
|
re-running that test |
The testing error is due to the |
Thanks @mattfarina!! |
Hi guys!
This is a proposal to add a function to resolve names to IPs. I'm a heavy user of helm and this is useful where you need to render an IP but you don't want to hardcode it in your templates.
What do you think?