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
6e6fa359
Commit
6e6fa359
authored
2 years ago
by
Vincent Hatakeyama
Browse files
Options
Downloads
Patches
Plain Diff
fix rednerd api key value update
parent
21bed38b
No related branches found
Branches containing commit
Tags
20.0.1
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NEWS.rst
+5
-0
5 additions, 0 deletions
NEWS.rst
odoo_scripts/docker_rednerd.py
+27
-20
27 additions, 20 deletions
odoo_scripts/docker_rednerd.py
with
32 additions
and
20 deletions
NEWS.rst
+
5
−
0
View file @
6e6fa359
...
...
@@ -2,6 +2,11 @@
History
=======
20.0.1
------
Fix getting the redner api key when starting it for Odoo.
20.0.0
------
...
...
This diff is collapsed.
Click to expand it.
odoo_scripts/docker_rednerd.py
+
27
−
20
View file @
6e6fa359
...
...
@@ -25,5 +25,5 @@
_logger
=
logging
.
getLogger
(
__name__
)
__version__
=
"
1.1.
2
"
__version__
=
"
1.1.
3
"
__date__
=
"
2021-01-14
"
...
...
@@ -29,5 +29,5 @@
__date__
=
"
2021-01-14
"
__updated__
=
"
2023-0
1-20
"
__updated__
=
"
2023-0
3-16
"
MIGRATE
=
"
migrate
"
ADMIN_PASSWORD
=
"
admin-password
"
...
...
@@ -74,9 +74,8 @@
:param force_pull: Indicate to pull the latest version of the specified image,
otherwise the image will only be pulled if not present
"""
assert
all
(
argument
is
not
None
for
argument
in
(
for
i
,
argument
in
enumerate
(
(
docker_client
,
project_name
,
repository
,
...
...
@@ -84,7 +83,8 @@
database
,
db_host
,
)
),
"
Missing required argument
"
):
assert
argument
is
not
None
,
"
Missing required argument %s
"
%
i
# db_password can be none, in that case expect that any password would work
super
().
__init__
()
self
.
name
=
f
"
rednerd_
{
project_name
}
"
...
...
@@ -188,7 +188,7 @@
if
hasattr
(
self
,
"
redner_port
"
):
# useless when using --network=host
ports
[
f
"
{
self
.
redner_port
}
/tcp
"
]
=
self
.
redner_port
_logger
.
info
(
"
Using port %
d
"
,
self
.
redner_port
)
_logger
.
info
(
"
Using port %
s
"
,
self
.
redner_port
)
if
hasattr
(
self
,
"
socket_dir
"
):
volumes
[
self
.
socket_dir
]
=
{
"
bind
"
:
self
.
socket_dir
,
...
...
@@ -289,4 +289,5 @@
)
request
.
raise_for_status
()
api_keys_list
=
request
.
json
()
name
=
"
docker_rednerd
"
if
len
(
api_keys_list
)
>
0
:
...
...
@@ -292,17 +293,23 @@
if
len
(
api_keys_list
)
>
0
:
self
.
api_key
=
api_keys_list
[
0
][
"
value
"
]
if
self
.
api_key
is
None
:
_logger
.
info
(
"
No API key found, creating one
"
)
# create a new token otherwise
request
=
session
.
post
(
f
"
{
base_url
}
/api/v1/user/
{
self
.
redner_user
}
/apikey
"
,
json
=
{
"
name
"
:
"
docker_rednerd
"
,
"
description
"
:
"
Odoo scripts created API KEY
"
,
},
cookies
=
cookie_jar
,
)
self
.
api_key
=
request
.
json
()[
"
value
"
]
# delete our api key to retrieve its value again after creating it
for
api_keys_data
in
api_keys_list
:
if
api_keys_data
[
"
name
"
]
==
name
:
request
=
session
.
delete
(
f
"
{
base_url
}
/api/v1/user/
{
self
.
redner_user
}
/apikey/
{
name
}
"
,
json
=
{},
cookies
=
cookie_jar
,
)
request
.
raise_for_status
()
_logger
.
info
(
"
Creating new API key
"
)
request
=
session
.
post
(
f
"
{
base_url
}
/api/v1/user/
{
self
.
redner_user
}
/apikey
"
,
json
=
{
"
name
"
:
name
,
"
description
"
:
"
Odoo scripts created API KEY
"
,
},
cookies
=
cookie_jar
,
)
self
.
api_key
=
request
.
json
()[
"
value
"
]
if
self
.
stop_at_exit
:
atexit
.
register
(
self
.
stop_and_remove
)
...
...
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