Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
configdb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ai
configdb
Commits
abce8443
Commit
abce8443
authored
11 years ago
by
joe
Browse files
Options
Downloads
Patches
Plain Diff
Changed the encode/decode of master keys to handle how etcd works.
Also fixed a typo in calling write() with a parameter.
parent
31b1f6ab
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
configdb/db/interface/etcd_interface.py
+5
-6
5 additions, 6 deletions
configdb/db/interface/etcd_interface.py
with
5 additions
and
6 deletions
configdb/db/interface/etcd_interface.py
+
5
−
6
View file @
abce8443
...
@@ -22,11 +22,10 @@ class EtcdSession(inmemory_interface.InMemorySession):
...
@@ -22,11 +22,10 @@ class EtcdSession(inmemory_interface.InMemorySession):
self
.
db
=
db
self
.
db
=
db
def
_escape
(
self
,
s
):
def
_escape
(
self
,
s
):
# Hack alert! Since etcd interprets any '/' as a dir separator,
return
s
.
encode
(
'
hex
'
)
# we simply replace it with a double backslash in the path.
# this of course introduces a potential bug.
def
_unescape
(
self
,
s
):
s
=
s
.
replace
(
'
/
'
,
'
\\\\
'
)
return
s
.
decode
(
'
hex
'
)
return
urllib
.
quote
(
s
,
safe
=
''
)
def
_mkpath
(
self
,
entity_name
,
obj_name
=
None
):
def
_mkpath
(
self
,
entity_name
,
obj_name
=
None
):
path
=
os
.
path
.
join
(
self
.
db
.
root
,
self
.
_escape
(
entity_name
))
path
=
os
.
path
.
join
(
self
.
db
.
root
,
self
.
_escape
(
entity_name
))
...
@@ -188,7 +187,7 @@ class EtcdInterface(base.DbInterface):
...
@@ -188,7 +187,7 @@ class EtcdInterface(base.DbInterface):
}
}
self
.
conn
.
write
(
path
,
json
.
dumps
(
audit
))
self
.
conn
.
write
(
path
,
json
.
dumps
(
audit
))
try
:
try
:
self
.
conn
.
write
(
path
,
json
.
dumps
(
audit
)
,
prevExist
=
False
)
self
.
conn
.
write
(
path
,
json
.
dumps
(
audit
))
except
ValueError
:
except
ValueError
:
pass
pass
...
...
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