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

sanitize hostname handling (fate #319639) #101

Merged
merged 3 commits into from May 17, 2016
Merged

sanitize hostname handling (fate #319639) #101

merged 3 commits into from May 17, 2016

Conversation

wfeldt
Copy link
Member

@wfeldt wfeldt commented May 4, 2016

Note that there are also linuxrc changes that go along with this.

Note that there are also linuxrc changes that go along with this.
@wfeldt
Copy link
Member Author

wfeldt commented May 4, 2016

openSUSE/linuxrc#108

wfeldt added a commit to yast/yast-yast2 that referenced this pull request May 9, 2016
@@ -197,7 +190,7 @@ if grep -qi "^VNC:.*1" /etc/install.inf ; then
if test "$ec" = "0" ; then
(
sleep 3
/usr/bin/slptool register "service:YaST.installation.suse:vnc://${hostname}:5901"
/usr/bin/slptool register "service:YaST.installation.suse:vnc://${host_name}:5901"
Copy link
Member

Choose a reason for hiding this comment

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

hostip_from_wicked prints hostname including \n at the end. Isn't it a problem (e.g.) here?

Copy link
Member Author

Choose a reason for hiding this comment

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

no, shell swallows white space

Copy link
Member

Choose a reason for hiding this comment

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

ehm, ok. So why do you explicitly append it? I'm just curios, not blocker for me ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

No idea; the code is not by me. If you say it's not necessary, I'm fine with another line.

@@ -55,7 +55,7 @@ unset SSH_FAILED
stty sane 2>/dev/null

# get hostname & hostips
hostip_from_wicked >/tmp/host_ips 2>/tmp/host_name
hostip_from_wicked /tmp/host_ips /tmp/host_name
Copy link
Member

Choose a reason for hiding this comment

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

ehm, is it possible to split / refactor this into two functions / helper scripts to have just hostip_from_wicked and e.g. hostname_from_wicked?

Moreover, I'd fix the behavior when host_name sometimes contains hostname and sometimes first ip.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why can't I extract two things from a single wicked run?

host_name is either a fqdn or the ip if no dns is available. I think it's named 'fqhn' sometimes. What's so bad about it?

Copy link
Member

Choose a reason for hiding this comment

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

Why can't I extract two things from a single wicked run?

Common practice is to have one method to do just one thing. In the current state I'd expect that the function / script returns just one IP ... In reality it writes a list of ips into a file (with kind of header prepended) and hostname into another file.

host_name is either a fqdn or the ip if no dns is available. I think it's named 'fqhn' sometimes. What's so bad about it?

well, so far we has been talking about fqdn. So at least documentation should be fixed.

Copy link
Member

Choose a reason for hiding this comment

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

@mvidner As I'm not strong in perl could you pls also review? Thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

Common practice is to have one method to do just one thing

I'd follow you for ruby methods or oo in general, but not shell scripts. If the name irks you, we can rename
the script to something else.

So at least documentation should be fixed.

It does exactly what is documented.

Copy link
Member

Choose a reason for hiding this comment

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

Common practice is to have one method to do just one thing

I'd follow you for ruby methods or oo in general, but not shell scripts. If the name irks you, we > can rename
the script to something else.

then rename. Thanks

@mvidner
Copy link
Member

mvidner commented May 17, 2016

LGTM

@wfeldt wfeldt merged commit b24450f into master May 17, 2016
@wfeldt wfeldt deleted the fate_319639 branch September 27, 2018 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants