Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
f2babb12
Commit
f2babb12
authored
Oct 02, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand ~(user) construction for all paths in configuration
Before, it was only done for 'logfile'.
parent
57481c35
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
7 deletions
+13
-7
neo.conf
neo.conf
+4
-1
neo/lib/config.py
neo/lib/config.py
+1
-1
neo/storage/database/importer.py
neo/storage/database/importer.py
+2
-1
neo/storage/database/mysqldb.py
neo/storage/database/mysqldb.py
+4
-3
neo/storage/database/sqlite.py
neo/storage/database/sqlite.py
+2
-1
No files found.
neo.conf
View file @
f2babb12
...
...
@@ -5,6 +5,9 @@
# See SafeConfigParser at https://docs.python.org/2/library/configparser.html
# for more information about the syntax.
# ~ and ~user constructions are expanded for all paths, even for those that
# may appear in 'database' option.
# Common parameters.
[
DEFAULT
]
# The cluster name
...
...
@@ -54,7 +57,7 @@ partitions: 12
[
admin
]
bind
:
127
.
0
.
0
.
1
:
9999
# Paths to log files can be specified here, but be careful not to do it in a
# common section.
~ and ~user constructions are expanded.
# common section.
;
logfile
: ~/
log
/
admin
.
log
# Master nodes
...
...
neo/lib/config.py
View file @
f2babb12
...
...
@@ -102,7 +102,7 @@ class ConfigurationManager(object):
return
self
.
__get
(
'wait'
)
def
getDynamicMasterList
(
self
):
return
self
.
__get
(
'dynamic_master_list'
,
optional
=
True
)
return
self
.
__get
Path
(
'dynamic_master_list'
,
optional
=
True
)
def
getAdapter
(
self
):
return
self
.
__get
(
'adapter'
)
...
...
neo/storage/database/importer.py
View file @
f2babb12
...
...
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
os
import
cPickle
,
pickle
,
time
from
bisect
import
bisect
,
insort
from
collections
import
deque
...
...
@@ -286,7 +287,7 @@ class ImporterDatabaseManager(DatabaseManager):
def
_parse
(
self
,
database
):
config
=
SafeConfigParser
()
config
.
read
(
database
)
config
.
read
(
os
.
path
.
expanduser
(
database
)
)
sections
=
config
.
sections
()
# XXX: defaults copy & pasted from elsewhere - refactoring needed
main
=
{
'adapter'
:
'MySQL'
,
'wait'
:
0
}
...
...
neo/storage/database/mysqldb.py
View file @
f2babb12
...
...
@@ -21,6 +21,7 @@ from MySQLdb.constants.CR import SERVER_GONE_ERROR, SERVER_LOST
from
MySQLdb.constants.ER
import
DATA_TOO_LONG
,
DUP_ENTRY
from
array
import
array
from
hashlib
import
sha1
import
os
import
re
import
string
import
struct
...
...
@@ -57,9 +58,9 @@ class MySQLDatabaseManager(DatabaseManager):
def
_parse
(
self
,
database
):
""" Get the database credentials (username, password, database) """
# expected pattern : [user[:password]@]database[(.|/)unix_socket]
# expected pattern : [user[:password]@]database[(
~|
.|/)unix_socket]
self
.
user
,
self
.
passwd
,
self
.
db
,
self
.
socket
=
re
.
match
(
'(?:([^:]+)(?::(.*))?@)?([^./]+)(.+)?$'
,
database
).
groups
()
'(?:([^:]+)(?::(.*))?@)?([^
~
./]+)(.+)?$'
,
database
).
groups
()
def
close
(
self
):
self
.
conn
.
close
()
...
...
@@ -69,7 +70,7 @@ class MySQLDatabaseManager(DatabaseManager):
if
self
.
passwd
is
not
None
:
kwd
[
'passwd'
]
=
self
.
passwd
if
self
.
socket
:
kwd
[
'unix_socket'
]
=
self
.
socket
kwd
[
'unix_socket'
]
=
os
.
path
.
expanduser
(
self
.
socket
)
logging
.
info
(
'connecting to MySQL on the database %s with user %s'
,
self
.
db
,
self
.
user
)
if
self
.
_wait
<
0
:
...
...
neo/storage/database/sqlite.py
View file @
f2babb12
...
...
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
os
import
sqlite3
from
hashlib
import
sha1
import
string
...
...
@@ -70,7 +71,7 @@ class SQLiteDatabaseManager(DatabaseManager):
self
.
_connect
()
def
_parse
(
self
,
database
):
self
.
db
=
database
self
.
db
=
os
.
path
.
expanduser
(
database
)
def
close
(
self
):
self
.
conn
.
close
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment