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
db91714b
Commit
db91714b
authored
Jul 23, 2015
by
Ernesto Rodriguez Ortiz
Browse files
Improuve the way of manage the addition to the file /etc/hosts the docker containers
Refs: #78054
parent
7e6457bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
fabfile.py
View file @
db91714b
...
...
@@ -120,8 +120,13 @@ 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
))):
local
(
'sudo sed -i "/127.0.0.1/i\{} {}" /etc/hosts'
.
format
(
ip
,
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 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
))
def
fab_remove_from_hosts
(
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