Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
drupalizer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Drupal
drupalizer
Commits
10db8314
Commit
10db8314
authored
Nov 24, 2016
by
Victor Nikulshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SSH-connect to Docker container as 'drupalizer' user
parent
898310e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
helpers.py
helpers.py
+14
-2
No files found.
helpers.py
View file @
10db8314
...
...
@@ -18,12 +18,14 @@
from
__future__
import
unicode_literals
import
os
import
socket
from
getpass
import
getuser
from
fabric.api
import
lcd
,
cd
,
roles
,
local
,
run
from
fabric.colors
import
green
from
fabric.context_managers
import
settings
from
fabric.contrib.console
import
confirm
from
fabric.contrib.files
import
exists
...
...
@@ -43,7 +45,7 @@ host_name = local("hostname", capture=True)
# Set the env dict with the roles and the hosts
env
.
roledefs
[
'local'
]
=
[
"{}@{}"
.
format
(
user_name
,
host_name
)]
env
.
roledefs
[
'docker'
]
=
[
"
root
@{}"
.
format
(
env
.
container_ip
)]
env
.
roledefs
[
'docker'
]
=
[
"
drupalizer
@{}"
.
format
(
env
.
container_ip
)]
env
.
builddir
=
path
.
join
(
env
.
workspace
,
'build'
)
...
...
@@ -68,7 +70,8 @@ def fab_run(role="local", cmd=""):
if
role
==
"local"
:
return
local
(
cmd
)
else
:
return
run
(
cmd
)
with
settings
(
key_filename
=
fab_path
(
"docker/ssh/id_rsa"
)):
return
run
(
cmd
)
def
fab_cd
(
role
,
directory
):
...
...
@@ -200,3 +203,12 @@ def init_db(role='docker'):
'
\'
{}
\'
@
\'
localhost
\'
IDENTIFIED BY
\'
{}
\'
; GRANT ALL PRIVILEGES ON {}.* TO
\'
{}
\'
@
\'
{}
\'
'
'IDENTIFIED BY
\'
{}
\'
; FLUSH PRIVILEGES;"'
.
format
(
env
.
site_db_name
,
env
.
site_db_name
,
env
.
site_db_user
,
env
.
site_db_pass
,
env
.
site_db_name
,
env
.
site_db_user
,
docker_iface_ip
,
env
.
site_db_user
))
def
fab_path
(
filename
):
"""
Returns the full path a file relative to the location of fabfile.
:param filename Name of the file to compose path from.
"""
path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
return
os
.
path
.
abspath
(
'{0}/{1}'
.
format
(
path
,
filename
))
Write
Preview
Markdown
is supported
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