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
76eb4ecdaacf
Commit
76eb4ecdaacf
authored
4 years ago
by
Vincent Hatakeyama
Browse files
Options
Downloads
Patches
Plain Diff
more options can be expanded
parent
128401348e8f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!22
✨ more options can be expanded
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NEWS.rst
+2
-0
2 additions, 0 deletions
NEWS.rst
odoo_scripts/config.py
+35
-2
35 additions, 2 deletions
odoo_scripts/config.py
with
37 additions
and
2 deletions
NEWS.rst
+
2
−
0
View file @
76eb4ecd
...
...
@@ -9,6 +9,8 @@
Push image to our registry too.
More options can be expanded.
7.0.3
-----
...
...
This diff is collapsed.
Click to expand it.
odoo_scripts/config.py
+
35
−
2
View file @
76eb4ecd
...
...
@@ -125,6 +125,39 @@
for
key
in
(
"
db_user
"
,
"
db_password
"
,
"
load-language
"
):
setattr
(
self
,
key_format
(
key
),
section
.
get
(
key
,
None
))
def
read_expanded
(
key
:
str
,
default_value
=
None
,
always_set
:
bool
=
False
):
"""
Read from local version, or from expanded if value is found.
Raise an exception if more than one value is found.
"""
value
=
default_value
if
toread
(
key
):
found
=
False
for
config
in
self
.
_expanded_configuration
.
values
():
if
hasattr
(
config
,
key
):
if
found
:
raise
Exception
(
"
Key %s to read in several expanded
"
"
configurations
"
%
key
)
else
:
value
=
getattr
(
config
,
key
)
found
=
True
if
key
in
section
:
local_value
=
section
.
get
(
key
,
default_value
)
if
(
found
and
value
!=
default_value
and
local_value
!=
value
):
raise
Exception
(
"
Key %s in expanded configuration and locally set
"
"
with different values
"
%
key
)
value
=
local_value
if
toread
(
key
)
or
always_set
:
setattr
(
self
,
key
,
value
)
self
.
registry
=
section
.
get
(
"
registry
"
,
"
registry.xcg.io
"
)
project_path
=
os
.
path
.
realpath
(
"
.
"
)
self
.
image
=
section
.
get
(
"
image
"
,
os
.
path
.
basename
(
project_path
))
...
...
@@ -128,7 +161,7 @@
self
.
registry
=
section
.
get
(
"
registry
"
,
"
registry.xcg.io
"
)
project_path
=
os
.
path
.
realpath
(
"
.
"
)
self
.
image
=
section
.
get
(
"
image
"
,
os
.
path
.
basename
(
project_path
))
self
.
odoo_type
=
section
.
get
(
"
odoo_type
"
,
"
odoo7
"
)
read_expanded
(
"
odoo_type
"
,
"
odoo7
"
,
always_set
=
True
)
if
self
.
odoo_type
not
in
(
"
odoo7
"
,
"
odoo8
"
,
...
...
@@ -137,7 +170,7 @@
"
odoo13
"
,
):
_logger
.
warning
(
"
Unexpected odoo_type: %s
"
,
self
.
odoo_type
)
self
.
postgresql_version
=
section
.
get
(
"
postgresql_version
"
,
"
9.6
"
)
read_expanded
(
"
postgresql_version
"
,
"
9.6
"
)
self
.
start_py3o
=
section
.
get
(
"
start_py3o
"
,
"
no
"
)
in
(
"
yes
"
,
"
true
"
)
...
...
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