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
7dad6c32cf7c
Commit
7dad6c32cf7c
authored
6 years ago
by
Vincent Hatakeyama
Browse files
Options
Downloads
Patches
Plain Diff
make docker_dev_start call build with dev option when the image is not present
parent
e7a9c854af88
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docker_build.py
+4
-7
4 additions, 7 deletions
docker_build.py
docker_dev_start.py
+29
-10
29 additions, 10 deletions
docker_dev_start.py
with
33 additions
and
17 deletions
docker_build.py
+
4
−
7
View file @
7dad6c32
...
...
@@ -21,5 +21,5 @@
_logger
=
logging
.
getLogger
(
__name__
)
__version__
=
'
0.
0.1
'
__version__
=
'
0.
1.0
'
__date__
=
'
2018-04-04
'
...
...
@@ -25,7 +25,7 @@
__date__
=
'
2018-04-04
'
__updated__
=
'
2018-04-0
4
'
__updated__
=
'
2018-04-0
6
'
def
main
(
argv
=
None
):
# IGNORE:C0111
"""
Parse arguments and docker build
"""
...
...
@@ -27,11 +27,8 @@
def
main
(
argv
=
None
):
# IGNORE:C0111
"""
Parse arguments and docker build
"""
if
argv
is
not
None
:
sys
.
argv
.
extend
(
argv
)
program_version
=
__version__
program_build_date
=
str
(
__updated__
)
program_version_message
=
'
%%(prog)s %s (%s)
'
%
(
...
...
@@ -91,7 +88,7 @@
# TODO detect that user is member of docker group
nmspc
=
parser
.
parse_args
()
nmspc
=
parser
.
parse_args
(
argv
)
verbose
=
nmspc
.
verbose
if
not
verbose
:
logging
.
basicConfig
(
level
=
logging
.
WARN
)
...
...
@@ -192,6 +189,6 @@
if
__name__
==
"
__main__
"
:
return_code
=
main
()
return_code
=
main
(
sys
.
argv
[
1
:]
)
if
return_code
:
exit
(
return_code
)
This diff is collapsed.
Click to expand it.
docker_dev_start.py
+
29
−
10
View file @
7dad6c32
...
...
@@ -26,5 +26,5 @@
_logger
=
logging
.
getLogger
(
__name__
)
__version__
=
'
0.1.1
'
__version__
=
'
1.0.0
'
__date__
=
'
2017-08-11
'
...
...
@@ -30,5 +30,5 @@
__date__
=
'
2017-08-11
'
__updated__
=
'
2018-04-0
4
'
__updated__
=
'
2018-04-0
6
'
def
which
(
program
):
...
...
@@ -55,9 +55,6 @@
def
main
(
argv
=
None
):
# IGNORE:C0111
"""
Parse arguments and launch conversion
"""
if
argv
is
not
None
:
sys
.
argv
.
extend
(
argv
)
program_version
=
__version__
program_build_date
=
str
(
__updated__
)
program_version_message
=
'
%%(prog)s %s (%s)
'
%
(
...
...
@@ -174,7 +171,18 @@
)
parser
.
add_argument
(
'
--no-flake8
'
,
help
=
"
Do not run flake8
"
,
help
=
"
Do not run flake8 [default: %(default)s]
"
,
action
=
'
store_true
'
,
)
build_group
=
parser
.
add_mutually_exclusive_group
()
build_group
.
add_argument
(
'
--no-build
'
,
help
=
"
Do not build locally [default: %(default)s]
"
,
action
=
'
store_true
'
,
)
build_group
.
add_argument
(
'
--force-build
'
,
help
=
"
Force new local build [default: %(default)s]
"
,
action
=
'
store_true
'
,
)
network_group
=
parser
.
add_mutually_exclusive_group
()
...
...
@@ -195,7 +203,7 @@
# TODO add a way to add options to docker
# TODO add a way to add arg to odoo
nmspc
=
parser
.
parse_args
()
nmspc
=
parser
.
parse_args
(
argv
)
verbose
=
nmspc
.
verbose
if
not
verbose
:
logging
.
basicConfig
(
level
=
logging
.
WARN
)
...
...
@@ -242,5 +250,5 @@
docker_client
=
docker_api
(
base_url
=
'
unix://var/run/docker.sock
'
)
image_list
=
docker_client
.
images
(
name
=
image
,
quiet
=
True
)
if
not
image_list
:
logging
.
warning
(
"
Image %s does not exist
"
,
image
)
logging
.
info
(
"
Image %s does not exist
"
,
image
)
else
:
...
...
@@ -246,5 +254,16 @@
else
:
logging
.
info
(
"
Test image found
"
)
logging
.
info
(
"
Image %s exists
"
,
image
)
if
(
not
image_list
and
not
nmspc
.
no_build
)
or
nmspc
.
force_build
:
logging
.
info
(
"
Building image %s
"
,
image
)
import
docker_build
arguments
=
[
'
--dev
'
]
if
verbose
==
1
:
arguments
.
append
(
'
-v
'
)
elif
verbose
and
verbose
>
1
:
arguments
.
append
(
'
-vv
'
)
docker_build
.
main
(
arguments
)
# options is only used with subprocess call
options
=
[
...
...
@@ -579,6 +598,6 @@
if
__name__
==
"
__main__
"
:
return_code
=
main
()
return_code
=
main
(
sys
.
argv
[
1
:]
)
if
return_code
:
exit
(
return_code
)
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