Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
devtools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
codeaster-fra
devtools
Commits
91d7d10d
Commit
91d7d10d
authored
3 months ago
by
Mathieu Courtois
Browse files
Options
Downloads
Patches
Plain Diff
[#30000] update FSQ script for REX authentication
parent
9e50597d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/contrib/rex_fsq.py
+4
-2
4 additions, 2 deletions
bin/contrib/rex_fsq.py
lib/api_roundup/rex.py
+24
-12
24 additions, 12 deletions
lib/api_roundup/rex.py
with
28 additions
and
14 deletions
bin/contrib/rex_fsq.py
+
4
−
2
View file @
91d7d10d
...
@@ -20,10 +20,12 @@ import api_roundup.stats as ST
...
@@ -20,10 +20,12 @@ import api_roundup.stats as ST
# labels des versions "précédentes" (histors dans lesquels chercher)
# labels des versions "précédentes" (histors dans lesquels chercher)
INFOS
=
{
"
vexpl
"
:
"
1
5.8
"
,
"
vdev
"
:
"
1
6.4
"
}
INFOS
=
{
"
vexpl
"
:
"
1
6.6
"
,
"
vdev
"
:
"
1
7.1
"
}
FILENAME
=
"
rex_all_issues.pick
"
FILENAME
=
"
rex_all_issues.pick
"
CHANGELOG_PATTERN
=
osp
.
join
(
os
.
environ
[
"
HOME
"
],
"
dev
"
,
"
codeaster
"
,
"
histor
"
,
"
1[0-9].*
"
)
CHANGELOG_PATTERN
=
osp
.
join
(
os
.
environ
[
"
HOME
"
],
"
dev
"
,
"
codeaster
"
,
"
changelog
"
,
"
histor
"
,
"
v*
"
,
"
[0-9].*
"
)
def
is_fixed
(
vers
,
issue
):
def
is_fixed
(
vers
,
issue
):
...
...
This diff is collapsed.
Click to expand it.
lib/api_roundup/rex.py
+
24
−
12
View file @
91d7d10d
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
see documentation at http://roundup.sourceforge.net/docs/xmlrpc.html
see documentation at http://roundup.sourceforge.net/docs/xmlrpc.html
"""
"""
import
base64
import
os
import
os
import
random
import
random
import
re
import
re
...
@@ -12,7 +13,7 @@ import ssl
...
@@ -12,7 +13,7 @@ import ssl
import
sys
import
sys
import
xmlrpc.client
import
xmlrpc.client
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
from
urllib
.request
import
urlopen
from
urllib
import
request
from
aslint.baseutils
import
force_list
from
aslint.baseutils
import
force_list
from
aslint.config
import
ASCFG
from
aslint.config
import
ASCFG
...
@@ -47,12 +48,8 @@ def _get_url(user="readonly", password="", debug=False):
...
@@ -47,12 +48,8 @@ def _get_url(user="readonly", password="", debug=False):
return
url
return
url
def
_get_connection
(
user
=
None
,
password
=
""
,
write
=
False
,
debug
=
False
):
def
_get_user_pass
(
user
=
None
,
password
=
""
,
write
=
False
):
"""
Return a connection to the Roundup server.
"""
Return user/password for requests with defaults and error message.
"""
If user/password are provided they are passed to the connection.
If they are not provided an anonymous user is used if write is False.
If write is True user/password are read from the configuration
([aster] section in ~/.gitconfig, option rex-write-user/rex-write-password).
"""
if
not
user
:
if
not
user
:
user
=
os
.
environ
.
get
(
"
REX_USERNAME
"
,
"
readonly
"
)
user
=
os
.
environ
.
get
(
"
REX_USERNAME
"
,
"
readonly
"
)
if
write
:
if
write
:
...
@@ -63,6 +60,18 @@ def _get_connection(user=None, password="", write=False, debug=False):
...
@@ -63,6 +60,18 @@ def _get_connection(user=None, password="", write=False, debug=False):
"
Valid REX credentials are required.
"
"
Valid REX credentials are required.
"
"
Please define REX_USERNAME and REX_PASSWORD environment variables.
"
"
Please define REX_USERNAME and REX_PASSWORD environment variables.
"
)
)
return
user
,
password
def
_get_connection
(
user
=
None
,
password
=
""
,
write
=
False
,
debug
=
False
):
"""
Return a connection to the Roundup server.
If user/password are provided they are passed to the connection.
If they are not provided an anonymous user is used if write is False.
If write is True user/password are read from the configuration
([aster] section in ~/.gitconfig, option rex-write-user/rex-write-password).
"""
user
,
password
=
_get_user_pass
(
user
,
password
,
write
)
url
=
_get_url
(
user
,
password
,
debug
)
url
=
_get_url
(
user
,
password
,
debug
)
if
(
sys
.
version_info
.
major
,
sys
.
version_info
.
minor
)
<
(
3
,
5
):
if
(
sys
.
version_info
.
major
,
sys
.
version_info
.
minor
)
<
(
3
,
5
):
server
=
xmlrpc
.
client
.
ServerProxy
(
url
,
allow_none
=
True
)
server
=
xmlrpc
.
client
.
ServerProxy
(
url
,
allow_none
=
True
)
...
@@ -414,15 +423,18 @@ def extract_csv(entity):
...
@@ -414,15 +423,18 @@ def extract_csv(entity):
columns
=
[
"
id
"
,
"
username
"
,
"
realname
"
,
"
organisation
"
,
"
address
"
,
"
roles
"
,
"
loginaster
"
]
columns
=
[
"
id
"
,
"
username
"
,
"
realname
"
,
"
organisation
"
,
"
address
"
,
"
roles
"
,
"
loginaster
"
]
else
:
else
:
raise
ValueError
(
"
unsupported entity: {0}
"
.
format
(
entity
))
raise
ValueError
(
"
unsupported entity: {0}
"
.
format
(
entity
))
url
=
(
url
=
(
"
{rex_url}/{entity}?@action=export_csv_names{columns}&:pagesize=50&:startwith=0
"
).
format
(
"
{rex_url}/{entity}?@action=export_csv_names
"
"
{columns}
"
"
&:pagesize=50&:startwith=0
"
).
format
(
rex_url
=
ASCFG
.
get
(
"
rex.url
"
),
rex_url
=
ASCFG
.
get
(
"
rex.url
"
),
entity
=
entity
,
entity
=
entity
,
columns
=
"
&:columns=
"
+
"
,
"
.
join
(
columns
)
if
columns
else
""
,
columns
=
"
&:columns=
"
+
"
,
"
.
join
(
columns
)
if
columns
else
""
,
)
)
req
=
request
.
Request
(
url
)
user
,
password
=
_get_user_pass
()
base64string
=
base64
.
b64encode
(
bytes
(
f
"
{
user
}
:
{
password
}
"
,
"
ascii
"
))
req
.
add_header
(
"
Authorization
"
,
"
Basic {}
"
.
format
(
base64string
.
decode
(
"
utf-8
"
)))
logger
.
info
(
_
(
"
exporting data as csv...
"
))
logger
.
info
(
_
(
"
exporting data as csv...
"
))
re
q
=
urlopen
(
url
)
re
sp
=
request
.
urlopen
(
req
)
content
=
re
q
.
read
()
content
=
re
sp
.
read
()
logger
.
debug
(
_
(
"
{:10} bytes downloaded
"
).
format
(
len
(
content
)))
logger
.
debug
(
_
(
"
{:10} bytes downloaded
"
).
format
(
len
(
content
)))
return
str
(
content
,
"
utf-8
"
)
return
str
(
content
,
"
utf-8
"
)
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