Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
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
RadioObservatory
LOFAR
Commits
59d52264
Commit
59d52264
authored
6 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
LSMR-20
: made module python3 compliant
parent
0dd5fa99
No related branches found
No related tags found
1 merge request
!87
Lsmr epic
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
LCS/PyCommon/dbcredentials.py
+7
-7
7 additions, 7 deletions
LCS/PyCommon/dbcredentials.py
with
7 additions
and
7 deletions
LCS/PyCommon/dbcredentials.py
+
7
−
7
View file @
59d52264
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
from
glob
import
glob
from
glob
import
glob
import
os
import
os
import
pwd
import
pwd
from
C
onfig
P
arser
import
SafeConfigParser
,
NoSectionError
,
DuplicateSectionError
from
c
onfig
p
arser
import
SafeConfigParser
,
NoSectionError
,
DuplicateSectionError
from
optparse
import
OptionGroup
from
optparse
import
OptionGroup
from
os
import
stat
,
path
,
chmod
from
os
import
stat
,
path
,
chmod
import
logging
import
logging
...
@@ -159,10 +159,10 @@ class DBCredentials:
...
@@ -159,10 +159,10 @@ class DBCredentials:
# make sure the files are mode 600 to hide passwords
# make sure the files are mode 600 to hide passwords
for
file
in
self
.
files
:
for
file
in
self
.
files
:
if
oct
(
stat
(
file
).
st_mode
&
0777
)
!=
'
0600
'
:
if
oct
(
stat
(
file
).
st_mode
&
0
o
777
)
!=
'
0
o
600
'
:
logger
.
info
(
'
Changing permissions of %s to 600
'
%
file
)
logger
.
info
(
'
Changing permissions of %s to 600
'
%
file
)
try
:
try
:
chmod
(
file
,
0600
)
chmod
(
file
,
0
o
600
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
'
Error: Could not change permissions on %s: %s
'
%
(
file
,
str
(
e
)))
logger
.
error
(
'
Error: Could not change permissions on %s: %s
'
%
(
file
,
str
(
e
)))
...
@@ -293,7 +293,7 @@ if __name__ == "__main__":
...
@@ -293,7 +293,7 @@ if __name__ == "__main__":
(
options
,
args
)
=
parser
.
parse_args
()
(
options
,
args
)
=
parser
.
parse_args
()
if
not
options
.
database
and
not
options
.
list
and
not
options
.
files
:
if
not
options
.
database
and
not
options
.
list
and
not
options
.
files
:
print
"
Missing database name
"
logger
.
error
(
"
Missing database name
"
)
parser
.
print_help
()
parser
.
print_help
()
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
@@ -302,16 +302,16 @@ if __name__ == "__main__":
...
@@ -302,16 +302,16 @@ if __name__ == "__main__":
if
options
.
files
:
if
options
.
files
:
"""
Print list of configuration files that we
'
ve read.
"""
"""
Print list of configuration files that we
'
ve read.
"""
if
dbc
.
files
:
if
dbc
.
files
:
print
"
\n
"
.
join
(
dbc
.
files
)
logger
.
info
(
"
\n
"
.
join
(
dbc
.
files
)
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
if
options
.
list
:
if
options
.
list
:
"""
Print list of databases.
"""
"""
Print list of databases.
"""
databases
=
dbc
.
list
()
databases
=
dbc
.
list
()
if
databases
:
if
databases
:
print
"
\n
"
.
join
(
databases
)
logger
.
info
(
"
\n
"
.
join
(
databases
)
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
"""
Print credentials of a specific database.
"""
"""
Print credentials of a specific database.
"""
print
str
(
dbc
.
get
(
options
.
database
))
logger
.
info
(
str
(
dbc
.
get
(
options
.
database
))
)
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