Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
106
Merge Requests
106
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
7184077e
Commit
7184077e
authored
Feb 08, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use global logger.
Fix Interface serializing that was trying to serialize logger as well.
parent
fa152753
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
slapos/format.py
slapos/format.py
+9
-7
No files found.
slapos/format.py
View file @
7184077e
...
@@ -54,6 +54,11 @@ import lxml.etree
...
@@ -54,6 +54,11 @@ import lxml.etree
from
slapos.version
import
version
from
slapos.version
import
version
# set up logging
logger
=
logging
.
getLogger
(
"slapformat"
)
logger
.
setLevel
(
logging
.
INFO
)
def
prettify_xml
(
xml
):
def
prettify_xml
(
xml
):
root
=
lxml
.
etree
.
fromstring
(
xml
)
root
=
lxml
.
etree
.
fromstring
(
xml
)
return
lxml
.
etree
.
tostring
(
root
,
pretty_print
=
True
)
return
lxml
.
etree
.
tostring
(
root
,
pretty_print
=
True
)
...
@@ -664,9 +669,6 @@ class Interface(object):
...
@@ -664,9 +669,6 @@ class Interface(object):
_
,
result
=
callAndRead
([
'ip'
,
'addr'
,
'list'
,
self
.
name
])
_
,
result
=
callAndRead
([
'ip'
,
'addr'
,
'list'
,
self
.
name
])
self
.
attach_to_tap
=
'DOWN'
in
result
.
split
(
'
\
n
'
,
1
)[
0
]
self
.
attach_to_tap
=
'DOWN'
in
result
.
split
(
'
\
n
'
,
1
)[
0
]
# XXX-Cedric should be global logger
self
.
logger
=
logging
.
getLogger
(
"slapformat"
)
def
__getinitargs__
(
self
):
def
__getinitargs__
(
self
):
return
(
self
.
name
,)
return
(
self
.
name
,)
...
@@ -817,7 +819,7 @@ class Interface(object):
...
@@ -817,7 +819,7 @@ class Interface(object):
if
self
.
_addSystemAddress
(
addr
,
netmask
,
False
):
if
self
.
_addSystemAddress
(
addr
,
netmask
,
False
):
return
dict
(
addr
=
addr
,
netmask
=
netmask
)
return
dict
(
addr
=
addr
,
netmask
=
netmask
)
else
:
else
:
self
.
logger
.
warning
(
'Impossible to add old local IPv4 %s. Generating '
logger
.
warning
(
'Impossible to add old local IPv4 %s. Generating '
'new IPv4 address.'
%
addr
)
'new IPv4 address.'
%
addr
)
return
self
.
_generateRandomIPv4Address
(
netmask
)
return
self
.
_generateRandomIPv4Address
(
netmask
)
else
:
else
:
...
@@ -875,7 +877,7 @@ class Interface(object):
...
@@ -875,7 +877,7 @@ class Interface(object):
# succeed, return it
# succeed, return it
return
dict
(
addr
=
addr
,
netmask
=
netmask
)
return
dict
(
addr
=
addr
,
netmask
=
netmask
)
else
:
else
:
self
.
logger
.
warning
(
'Impossible to add old public IPv6 %s. '
logger
.
warning
(
'Impossible to add old public IPv6 %s. '
'Generating new IPv6 address.'
%
addr
)
'Generating new IPv6 address.'
%
addr
)
# Try 10 times to add address, raise in case if not possible
# Try 10 times to add address, raise in case if not possible
...
@@ -1151,8 +1153,8 @@ class Config(object):
...
@@ -1151,8 +1153,8 @@ class Config(object):
self
.
cert_file
=
None
self
.
cert_file
=
None
# set up logging
# set up logging
self
.
logger
=
logging
.
getLogger
(
"slapformat"
)
# XXX-Cedric: change code to use global logger
self
.
logger
.
setLevel
(
logging
.
INFO
)
self
.
logger
=
logger
# Set options parameters
# Set options parameters
for
option
,
value
in
option_dict
.
__dict__
.
items
():
for
option
,
value
in
option_dict
.
__dict__
.
items
():
...
...
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