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

Hostname and FQDN should be done in one line #2334

Merged
merged 5 commits into from
Oct 15, 2013

Conversation

elliotsegler
Copy link
Contributor

I believe this should fix issue #2333

Edit: I've updated the request with elliotsegler@06aaa6e. It's a better fix.

@regilero
Copy link

regilero commented Oct 7, 2013

related issues #2309

@jcftang
Copy link

jcftang commented Oct 7, 2013

+1 on this, tested the patch and it fixes up the issue.

@lra
Copy link
Contributor

lra commented Oct 9, 2013

We have the same issue so I looked at it a bit.
I don't think the boundaries are needed in the regexp, the 1st one is implicit with the beginning of the line already specified, and the second one, we really want to look for a whitespace char.
But the boundaries are useful after the hostname as we don't know if the line will end here or if some other text will be there.

In short:

comm.sudo("sed -ri 's@^((\\b[0-9]{1,3}\.){3}[0-9]{1,3})\\b.*(localhost).*$@\\1\\t#{name} #{name.split('.')[0]} \\3@g' /etc/hosts")
comm.sudo("sed -ri 's@^((\\b[0-9]{1,3}\.){3}[0-9]{1,3})\\b.*(precise64).*$@\\1\\t#{name} #{name.split('.')[0]}@g' /etc/hosts")

could be

comm.sudo("sed -ri 's@^(([0-9]{1,3}\.){3}[0-9]{1,3})\\s+(localhost)\\b.*$@\\1\\t#{name} #{name.split('.')[0]} \\3@g' /etc/hosts")
comm.sudo("sed -ri 's@^(([0-9]{1,3}\.){3}[0-9]{1,3})\\s+(precise64)\\b.*$@\\1\\t#{name} #{name.split('.')[0]}@g' /etc/hosts")

See elliotsegler#1

Update boundary usage in the sed regexp to update the hosts file
@elliotsegler
Copy link
Contributor Author

Yep, agreed.

@ericclemmons
Copy link

So... 1.3.4 is broken until this is merged, right?

@mitchellh
Copy link
Contributor

Thanks so much :) Merging

mitchellh added a commit that referenced this pull request Oct 15, 2013
guests/ubuntu: Hostname and FQDN should be done in one line
@mitchellh mitchellh merged commit f988db9 into hashicorp:master Oct 15, 2013
@renan
Copy link

renan commented Oct 15, 2013

Err.. Any chances to release it?

# Second to set hostname
comm.sudo("sed -i 's@#{old.split('.')[0]}@#{name.split('.')[0]}@' /etc/hosts")
comm.sudo("sed -ri 's@^(([0-9]{1,3}\.){3}[0-9]{1,3})\\s+(localhost)\\b.*$@\\1\\t#{name} #{name.split('.')[0]} \\3@g' /etc/hosts")
comm.sudo("sed -ri 's@^(([0-9]{1,3}\.){3}[0-9]{1,3})\\s+(precise64)\\b.*$@\\1\\t#{name} #{name.split('.')[0]}@g' /etc/hosts")
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't precice64 here be #{old} or something?

@tmatilai
Copy link
Contributor

Also the corresponding Debian cap is broken.

tmatilai added a commit to tmatilai/vagrant that referenced this pull request Oct 15, 2013
@regilero
Copy link

+1 for a release, I think we can state that release 1.3.4 is hardly broken.

@mitchellh
Copy link
Contributor

@regilero 1.3.5 came out today.

@JBBSS
Copy link

JBBSS commented Sep 17, 2014

Any updates on this as we are also running into a similar problem?

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants