Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.devtools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.devtools
Commits
852070d2
Commit
852070d2
authored
5 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[dav] Rename config file as ~/.bdtrc
parent
d3f2f407
No related branches found
No related tags found
1 merge request
!99
WebDAV support improvements
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/devtools/dav.py
+13
-10
13 additions, 10 deletions
bob/devtools/dav.py
with
13 additions
and
10 deletions
bob/devtools/dav.py
+
13
−
10
View file @
852070d2
...
...
@@ -2,8 +2,11 @@
# -*- coding: utf-8 -*-
import
os
import
re
import
configparser
from
distutils.version
import
StrictVersion
from
.log
import
get_logger
,
echo_warning
,
echo_info
from
.deploy
import
_setup_webdav_client
...
...
@@ -13,25 +16,25 @@ logger = get_logger(__name__)
def
_get_config
():
"""
Returns a dictionary with server parameters, or ask them to the user
"""
# tries to figure if we can authenticate using a
global
configuration
cfgs
=
[
"
~/.bdt
-webdav
.cfg
"
]
# tries to figure if we can authenticate using a configuration
file
cfgs
=
[
"
~/.bdt.cfg
"
]
cfgs
=
[
os
.
path
.
expanduser
(
k
)
for
k
in
cfgs
]
for
k
in
cfgs
:
if
os
.
path
.
exists
(
k
):
data
=
configparser
.
ConfigParser
()
data
.
read
(
k
)
if
(
"
global
"
not
in
data
or
"
server
"
not
in
data
[
"
global
"
]
or
"
username
"
not
in
data
[
"
global
"
]
or
"
password
"
not
in
data
[
"
global
"
]
"
webdav
"
not
in
data
or
"
server
"
not
in
data
[
"
webdav
"
]
or
"
username
"
not
in
data
[
"
webdav
"
]
or
"
password
"
not
in
data
[
"
webdav
"
]
):
assert
KeyError
,
(
"
The file %s should contain a single
"
'"
global
"
section with 3 variables defined inside:
'
'"
dav
"
section with 3 variables defined inside:
'
'"
server
"
,
"
username
"
,
"
password
"
.
'
%
(
k
,)
)
return
data
[
"
global
"
]
return
data
[
"
dav
"
]
# ask the user for the information, cache credentials for future use
retval
=
dict
()
...
...
@@ -41,7 +44,7 @@ def _get_config():
# record file for the user
data
=
configparser
.
ConfigParser
()
data
[
"
global
"
]
=
retval
data
[
"
webdav
"
]
=
retval
with
open
(
cfgs
[
0
],
"
w
"
)
as
f
:
logger
.
warn
(
'
Recorded
"
%s
"
configuration file for next queries
'
)
data
.
write
(
f
)
...
...
@@ -124,7 +127,7 @@ def remove_old_beta_packages(client, path, dry_run, pyver=True):
if
result
is
not
None
:
name
+=
"
/
"
+
result
.
string
[:
4
]
target
=
'
/
'
.
join
(
path
,
f
)
target
=
'
/
'
.
join
(
(
path
,
f
)
)
info
=
client
.
info
(
target
)
betas
.
setdefault
(
name
,
[]).
append
(
...
...
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