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
b5b2080e
Commit
b5b2080e
authored
Nov 02, 2016
by
20th (Victor Nikulshin)
Committed by
Victor Nikulshin
Nov 07, 2016
Browse files
Do not update /etc/hosts file if target hostname is not set
parent
b2e327dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
helpers.py
View file @
b5b2080e
...
@@ -105,6 +105,9 @@ def fab_add_to_hosts(ip, site_hostname):
...
@@ -105,6 +105,9 @@ def fab_add_to_hosts(ip, site_hostname):
:param site_hostname:
:param site_hostname:
:return:
:return:
"""
"""
if
not
site_hostname
:
return
if
confirm
(
green
(
'Do you want add to the /etc/hosts the line "{} {}"? '
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 '
'If you say yes you will be able to visit the site using a more frienldy url '
'"http://{}".'
.
format
(
ip
,
site_hostname
,
site_hostname
))):
'"http://{}".'
.
format
(
ip
,
site_hostname
,
site_hostname
))):
...
@@ -123,6 +126,9 @@ def fab_remove_from_hosts(site_hostname):
...
@@ -123,6 +126,9 @@ def fab_remove_from_hosts(site_hostname):
:param site_hostname:
:param site_hostname:
:return:
:return:
"""
"""
if
not
site_hostname
:
return
print
(
green
(
'Enter your password to remove the {} from your /etc/hosts file'
.
format
(
site_hostname
)))
print
(
green
(
'Enter your password to remove the {} from your /etc/hosts file'
.
format
(
site_hostname
)))
local
(
'sudo sed -i "/{}/d" /etc/hosts'
.
format
(
site_hostname
))
local
(
'sudo sed -i "/{}/d" /etc/hosts'
.
format
(
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