Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Odoo scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo scripts
Commits
c3cb3d84
Commit
c3cb3d84
authored
7 years ago
by
Vincent Hatakeyama
Browse files
Options
Downloads
Patches
Plain Diff
flake8
parent
4163171b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
conf2reST.py
+7
-4
7 additions, 4 deletions
conf2reST.py
docker_dev_start.py
+11
-7
11 additions, 7 deletions
docker_dev_start.py
with
18 additions
and
11 deletions
conf2reST.py
+
7
−
4
View file @
c3cb3d84
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
__date__
=
'
2016-07-15
'
__date__
=
'
2016-07-15
'
__updated__
=
'
2016-07-15
'
__updated__
=
'
2016-07-15
'
def
main
(
argv
=
None
):
# IGNORE:C0111
def
main
(
argv
=
None
):
# IGNORE:C0111
"""
Parse arguments and launch conversion
"""
Parse arguments and launch conversion
"""
"""
...
@@ -42,8 +43,8 @@
...
@@ -42,8 +43,8 @@
USAGE
USAGE
'''
%
(
'''
%
(
program_shortdesc
,
program_shortdesc
,
str
(
__date__
),
str
(
__date__
),
)
)
# Argument parsing
# Argument parsing
parser
=
argparse
.
ArgumentParser
(
parser
=
argparse
.
ArgumentParser
(
...
@@ -78,6 +79,7 @@
...
@@ -78,6 +79,7 @@
basedir
=
os
.
path
.
dirname
(
sys
.
argv
[
0
])
basedir
=
os
.
path
.
dirname
(
sys
.
argv
[
0
])
conf2rst
(
basedir
,
nmspc
.
directory
,
nmspc
.
output
)
conf2rst
(
basedir
,
nmspc
.
directory
,
nmspc
.
output
)
def
conf2rst
(
basedir
,
directory
,
output
=
None
):
def
conf2rst
(
basedir
,
directory
,
output
=
None
):
"""
"""
:param basedir: directory with the odoo_versions.csv file
:param basedir: directory with the odoo_versions.csv file
...
@@ -197,10 +199,10 @@
...
@@ -197,10 +199,10 @@
repository
=
rst
[
group
][
element
].
get
(
'
repository
'
,
''
)
repository
=
rst
[
group
][
element
].
get
(
'
repository
'
,
''
)
if
repository
.
startswith
(
'
ssh://hg@bitbucket.org/
'
):
if
repository
.
startswith
(
'
ssh://hg@bitbucket.org/
'
):
text
=
'
`%s <%s/commits/%s>`__
'
%
(
text
=
'
`%s <%s/commits/%s>`__
'
%
(
version
,
version
,
repository
.
replace
(
repository
.
replace
(
'
ssh://hg@bitbucket.org/
'
,
'
ssh://hg@bitbucket.org/
'
,
'
https://bitbucket.org/
'
),
'
https://bitbucket.org/
'
),
version
)
version
)
elif
repository
.
startswith
(
'
git@bitbucket.org:
'
):
elif
repository
.
startswith
(
'
git@bitbucket.org:
'
):
text
=
'
`%s <%s/commits/%s>`__
'
%
(
text
=
'
`%s <%s/commits/%s>`__
'
%
(
...
@@ -201,10 +203,10 @@
...
@@ -201,10 +203,10 @@
repository
.
replace
(
repository
.
replace
(
'
ssh://hg@bitbucket.org/
'
,
'
ssh://hg@bitbucket.org/
'
,
'
https://bitbucket.org/
'
),
'
https://bitbucket.org/
'
),
version
)
version
)
elif
repository
.
startswith
(
'
git@bitbucket.org:
'
):
elif
repository
.
startswith
(
'
git@bitbucket.org:
'
):
text
=
'
`%s <%s/commits/%s>`__
'
%
(
text
=
'
`%s <%s/commits/%s>`__
'
%
(
version
,
version
,
repository
.
replace
(
repository
.
replace
(
'
git@bitbucket.org:
'
,
'
git@bitbucket.org:
'
,
'
https://bitbucket.org/
'
).
replace
(
'
.git
'
,
''
),
'
https://bitbucket.org/
'
).
replace
(
'
.git
'
,
''
),
...
@@ -214,5 +216,6 @@
...
@@ -214,5 +216,6 @@
out
.
write
(
"
- %s
\n
"
%
text
)
out
.
write
(
"
- %s
\n
"
%
text
)
out
.
write
(
"
\n
"
)
out
.
write
(
"
\n
"
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
main
()
main
()
This diff is collapsed.
Click to expand it.
docker_dev_start.py
+
11
−
7
View file @
c3cb3d84
...
@@ -339,7 +339,7 @@
...
@@ -339,7 +339,7 @@
if
odoo_type
!=
'
odoo7
'
:
if
odoo_type
!=
'
odoo7
'
:
data_volume_name
=
'
{}_data
'
.
format
(
project_name
)
data_volume_name
=
'
{}_data
'
.
format
(
project_name
)
logging
.
debug
(
'
Using data volume %s
'
,
data_volume_name
)
logging
.
debug
(
'
Using data volume %s
'
,
data_volume_name
)
volume
=
get
Volume
(
docker_client
,
data_volume_name
)
create
Volume
(
docker_client
,
data_volume_name
)
# make sure the permission in the volume are correct
# make sure the permission in the volume are correct
mount_opts
=
'
{}:/mnt/data
'
.
format
(
data_volume_name
)
mount_opts
=
'
{}:/mnt/data
'
.
format
(
data_volume_name
)
# TODO replace by something cleaner if possible
# TODO replace by something cleaner if possible
...
@@ -357,7 +357,7 @@
...
@@ -357,7 +357,7 @@
# additionnal_addons only in odoo < 11
# additionnal_addons only in odoo < 11
for
extra_volume
in
[
'
additional_addons
'
,
'
var
'
,
'
data
'
]:
for
extra_volume
in
[
'
additional_addons
'
,
'
var
'
,
'
data
'
]:
volume_name
=
'
{}_opt_odoo_{}
'
.
format
(
project_name
,
extra_volume
)
volume_name
=
'
{}_opt_odoo_{}
'
.
format
(
project_name
,
extra_volume
)
# volume =
get
Volume(docker_client, volume_name)
# volume =
create
Volume(docker_client, volume_name)
binds
.
append
(
'
{}:/opt/odoo/{}
'
.
format
(
volume_name
,
extra_volume
))
binds
.
append
(
'
{}:/opt/odoo/{}
'
.
format
(
volume_name
,
extra_volume
))
if
start_postgresql
:
if
start_postgresql
:
...
@@ -369,7 +369,7 @@
...
@@ -369,7 +369,7 @@
postgresql_version
,
project_name
)
postgresql_version
,
project_name
)
host_pg_port
=
5433
host_pg_port
=
5433
# volume =
get
Volume(docker_client, pg_data_volume_name)
# volume =
create
Volume(docker_client, pg_data_volume_name)
host_config
=
docker_client
.
create_host_config
(
host_config
=
docker_client
.
create_host_config
(
binds
=
[
'
{}:/var/lib/postgresql
'
.
format
(
pg_data_volume_name
)],
binds
=
[
'
{}:/var/lib/postgresql
'
.
format
(
pg_data_volume_name
)],
port_bindings
=
{
5432
:
host_pg_port
},
port_bindings
=
{
5432
:
host_pg_port
},
...
@@ -395,7 +395,7 @@
...
@@ -395,7 +395,7 @@
try
:
try
:
if
local_ip
or
start_postgresql
:
if
local_ip
or
start_postgresql
:
port
=
host_pg_port
if
start_postgresql
else
None
port
=
host_pg_port
if
start_postgresql
else
None
_
=
connect
(
connect
(
user
=
user
,
user
=
user
,
password
=
password
,
password
=
password
,
database
=
'
postgres
'
,
database
=
'
postgres
'
,
...
@@ -403,7 +403,7 @@
...
@@ -403,7 +403,7 @@
port
=
port
,
port
=
port
,
)
)
else
:
else
:
_
=
connect
(
connect
(
user
=
user
,
user
=
user
,
password
=
password
,
password
=
password
,
database
=
'
postgres
'
,
database
=
'
postgres
'
,
...
@@ -523,7 +523,8 @@
...
@@ -523,7 +523,8 @@
logging
.
debug
(
'
'
.
join
(
cmd
))
logging
.
debug
(
'
'
.
join
(
cmd
))
call
(
cmd
)
call
(
cmd
)
def
getVolume
(
docker_client
,
data_volume_name
):
def
createVolume
(
docker_client
,
data_volume_name
):
"""
Return the volume passed in parameter, creating it if it does not exists
"""
Return the volume passed in parameter, creating it if it does not exists
"""
"""
volumes
=
docker_client
.
volumes
(
filters
=
{
'
name
'
:
data_volume_name
})
volumes
=
docker_client
.
volumes
(
filters
=
{
'
name
'
:
data_volume_name
})
...
@@ -534,6 +535,7 @@
...
@@ -534,6 +535,7 @@
logging
.
debug
(
'
Creating volume %s
'
,
data_volume_name
)
logging
.
debug
(
'
Creating volume %s
'
,
data_volume_name
)
return
docker_client
.
create_volume
(
name
=
data_volume_name
)
return
docker_client
.
create_volume
(
name
=
data_volume_name
)
def
isRunning
(
docker_client
,
container_id
):
def
isRunning
(
docker_client
,
container_id
):
"""
Return true if the container is still running
"""
Return true if the container is still running
"""
"""
...
@@ -537,7 +539,9 @@
...
@@ -537,7 +539,9 @@
def
isRunning
(
docker_client
,
container_id
):
def
isRunning
(
docker_client
,
container_id
):
"""
Return true if the container is still running
"""
Return true if the container is still running
"""
"""
return
len
(
docker_client
.
containers
(
filters
=
{
'
id
'
:
container_id
},
quiet
=
True
))
return
len
(
docker_client
.
containers
(
filters
=
{
'
id
'
:
container_id
},
quiet
=
True
))
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
return_code
=
main
()
return_code
=
main
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment