Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
slapos.core
Commits
cd813da7
Commit
cd813da7
authored
Apr 23, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provided (mandatory) logger to Interface instances
parent
77035bfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
slapos/format.py
slapos/format.py
+8
-6
No files found.
slapos/format.py
View file @
cd813da7
...
...
@@ -179,7 +179,9 @@ def _getDict(instance):
return
instance
result
=
{}
for
key
,
value
in
dikt
.
iteritems
():
result
[
key
]
=
_getDict
(
value
)
# do not attempt to serialize logger: it is both useless and recursive.
if
not
isinstance
(
instance
,
logging
.
Logger
):
result
[
key
]
=
_getDict
(
value
)
return
result
...
...
@@ -663,7 +665,7 @@ class Tap(object):
class
Interface
(
object
):
"""Represent a network interface on the system"""
def
__init__
(
self
,
name
,
ipv4_local_network
,
ipv6_interface
=
None
,
logger
=
None
):
def
__init__
(
self
,
logger
,
name
,
ipv4_local_network
,
ipv6_interface
=
None
):
"""
Attributes:
name: String, the name of the interface
...
...
@@ -924,8 +926,8 @@ def parse_computer_definition(config, definition_path):
address
,
netmask
=
computer_definition
.
get
(
'computer'
,
'address'
).
split
(
'/'
)
if
config
.
alter_network
and
config
.
interface_name
is
not
None
\
and
config
.
ipv4_local_network
is
not
None
:
interface
=
Interface
(
config
.
interface_name
,
config
.
ipv4_local_network
,
config
.
ipv6_interface
,
logger
=
config
.
logger
)
interface
=
Interface
(
config
.
logger
,
config
.
interface_name
,
config
.
ipv4_local_network
,
config
.
ipv6_interface
)
computer
=
Computer
(
reference
=
config
.
computer_id
,
interface
=
interface
,
...
...
@@ -961,14 +963,14 @@ def parse_computer_xml(config, xml_path):
reference
=
config
.
computer_id
,
ipv6_interface
=
config
.
ipv6_interface
)
# Connect to the interface defined by the configuration
computer
.
interface
=
Interface
(
config
.
interface_name
,
config
.
ipv4_local_network
,
computer
.
interface
=
Interface
(
config
.
logger
,
config
.
interface_name
,
config
.
ipv4_local_network
,
config
.
ipv6_interface
)
else
:
# If no pre-existent configuration found, create a new computer object
config
.
logger
.
warning
(
'Creating new data computer with id %r'
%
config
.
computer_id
)
computer
=
Computer
(
reference
=
config
.
computer_id
,
interface
=
Interface
(
config
.
interface_name
,
config
.
ipv4_local_network
,
interface
=
Interface
(
config
.
logger
,
config
.
interface_name
,
config
.
ipv4_local_network
,
config
.
ipv6_interface
),
addr
=
None
,
netmask
=
None
,
...
...
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