Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Drupal
drupalizer
Commits
a11f9d65
Commit
a11f9d65
authored
Jul 24, 2015
by
Ernesto Rodriguez Ortiz
Browse files
Fix bug in the way of manage the addition to the file /etc/hosts the docker containers
Refs: #78054
parent
db91714b
Changes
1
Hide whitespace changes
Inline
Side-by-side
fabfile.py
View file @
a11f9d65
...
...
@@ -120,10 +120,8 @@ def fab_add_to_hosts(ip, site_hostname):
if
confirm
(
green
(
'Do you want add to the /etc/hosts the line "{} {}"? '
'If you say yes you will be able to visit the site using a more frienldy url '
'"http://{}".'
.
format
(
ip
,
site_hostname
,
site_hostname
))):
# Remove if find to add later the comment "# Docker auto-added host" to the file /etc/hosts
# TODO: Find a better way to update or add the comment
local
(
'sudo sed -i "/# Docker auto-added host/d" /etc/hosts'
)
local
(
'sudo sed -i "$ a # Docker auto-added host" /etc/hosts'
)
# Add if not find the comment "# Docker auto-added host" to the file /etc/hosts
local
(
'grep "# Docker auto-added host" /etc/hosts > /dev/null || sudo sed -i "$ a # Docker auto-added host" /etc/hosts'
)
# Add the ip address and hostname after the comment "# Docker auto-added host"
local
(
'sudo sed -i "/# Docker auto-added host/a {} {}" /etc/hosts'
.
format
(
ip
,
site_hostname
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment