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
Nicolas Wavrant
slapos.core
Commits
e82a51c4
Commit
e82a51c4
authored
Feb 01, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor to use 'interface' name where 'bridge' was used
parent
1c1f266e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
62 deletions
+63
-62
slapos.cfg.example
slapos.cfg.example
+1
-1
slapos/format.py
slapos/format.py
+62
-61
No files found.
slapos.cfg.example
View file @
e82a51c4
...
@@ -9,7 +9,7 @@ buildout = /path/to/buildout/binary
...
@@ -9,7 +9,7 @@ buildout = /path/to/buildout/binary
computer_xml = /opt/slapos/slapos.xml
computer_xml = /opt/slapos/slapos.xml
log_file = /opt/slapos/slapformat.log
log_file = /opt/slapos/slapformat.log
partition_amount = 200
partition_amount = 200
bridg
e_name = br0
interfac
e_name = br0
partition_base_name = slappart
partition_base_name = slappart
user_base_name = slapuser
user_base_name = slapuser
tap_base_name = slaptap
tap_base_name = slaptap
...
...
slapos/format.py
View file @
e82a51c4
...
@@ -73,24 +73,24 @@ class OS(object):
...
@@ -73,24 +73,24 @@ class OS(object):
class
UsageError
(
Exception
):
class
UsageError
(
Exception
):
pass
pass
class
NoAddressOn
Bridg
e
(
Exception
):
class
NoAddressOn
Interfac
e
(
Exception
):
"""
"""
Exception raised if there's not address on the
bridg
e to construct IPv6
Exception raised if there's not address on the
interfac
e to construct IPv6
address with.
address with.
Attributes:
Attributes:
brige: String, the name of the
bridg
e.
brige: String, the name of the
interfac
e.
"""
"""
def
__init__
(
self
,
bridg
e
):
def
__init__
(
self
,
interfac
e
):
super
(
NoAddressOn
Bridg
e
,
self
).
__init__
(
super
(
NoAddressOn
Interfac
e
,
self
).
__init__
(
'No IPv6 found on
bridge %s to construct IPv6 with.'
%
(
bridg
e
,
)
'No IPv6 found on
interface %s to construct IPv6 with.'
%
(
interfac
e
,
)
)
)
class
AddressGenerationError
(
Exception
):
class
AddressGenerationError
(
Exception
):
"""
"""
Exception raised if the generation of an IPv6 based on the prefix obtained
Exception raised if the generation of an IPv6 based on the prefix obtained
from the
bridg
e failed.
from the
interfac
e failed.
Attributes:
Attributes:
addr: String, the invalid address the exception is raised for.
addr: String, the invalid address the exception is raised for.
...
@@ -161,15 +161,15 @@ class Computer(object):
...
@@ -161,15 +161,15 @@ class Computer(object):
instance_root
=
None
instance_root
=
None
software_root
=
None
software_root
=
None
def
__init__
(
self
,
reference
,
bridg
e
=
None
,
addr
=
None
,
netmask
=
None
,
def
__init__
(
self
,
reference
,
interfac
e
=
None
,
addr
=
None
,
netmask
=
None
,
ipv6_interface
=
None
,
software_user
=
'slapsoft'
):
ipv6_interface
=
None
,
software_user
=
'slapsoft'
):
"""
"""
Attributes:
Attributes:
reference: String, the reference of the computer.
reference: String, the reference of the computer.
bridge: String, if it has one, the name of the computer's bridg
e.
interface: String, the name of the computer's used interfac
e.
"""
"""
self
.
reference
=
str
(
reference
)
self
.
reference
=
str
(
reference
)
self
.
bridge
=
bridg
e
self
.
interface
=
interfac
e
self
.
partition_list
=
[]
self
.
partition_list
=
[]
self
.
address
=
addr
self
.
address
=
addr
self
.
netmask
=
netmask
self
.
netmask
=
netmask
...
@@ -177,17 +177,17 @@ class Computer(object):
...
@@ -177,17 +177,17 @@ class Computer(object):
self
.
software_user
=
software_user
self
.
software_user
=
software_user
def
__getinitargs__
(
self
):
def
__getinitargs__
(
self
):
return
(
self
.
reference
,
self
.
bridg
e
)
return
(
self
.
reference
,
self
.
interfac
e
)
def
getAddress
(
self
):
def
getAddress
(
self
):
"""
"""
Return a list of the
bridg
e address not attributed to any partition, (which
Return a list of the
interfac
e address not attributed to any partition, (which
are therefore free for the computer itself).
are therefore free for the computer itself).
Returns:
Returns:
False if the
bridg
e isn't available, else the list of the free addresses.
False if the
interfac
e isn't available, else the list of the free addresses.
"""
"""
if
self
.
bridg
e
is
None
:
if
self
.
interfac
e
is
None
:
return
dict
(
addr
=
self
.
address
,
netmask
=
self
.
netmask
)
return
dict
(
addr
=
self
.
address
,
netmask
=
self
.
netmask
)
computer_partition_address_list
=
[]
computer_partition_address_list
=
[]
...
@@ -195,8 +195,8 @@ class Computer(object):
...
@@ -195,8 +195,8 @@ class Computer(object):
for
address
in
partition
.
address_list
:
for
address
in
partition
.
address_list
:
if
netaddr
.
valid_ipv6
(
address
[
'addr'
]):
if
netaddr
.
valid_ipv6
(
address
[
'addr'
]):
computer_partition_address_list
.
append
(
address
[
'addr'
])
computer_partition_address_list
.
append
(
address
[
'addr'
])
# Going through addresses of the computer's
bridg
e interface
# Going through addresses of the computer's
interfac
e interface
for
address_dict
in
self
.
bridg
e
.
getGlobalScopeAddressList
():
for
address_dict
in
self
.
interfac
e
.
getGlobalScopeAddressList
():
# Comparing with computer's partition addresses
# Comparing with computer's partition addresses
if
address_dict
[
'addr'
]
not
in
computer_partition_address_list
:
if
address_dict
[
'addr'
]
not
in
computer_partition_address_list
:
return
address_dict
return
address_dict
...
@@ -204,8 +204,8 @@ class Computer(object):
...
@@ -204,8 +204,8 @@ class Computer(object):
# all addresses on interface are for partition, so lets add new one
# all addresses on interface are for partition, so lets add new one
computer_tap
=
Tap
(
'compdummy'
)
computer_tap
=
Tap
(
'compdummy'
)
computer_tap
.
createWithOwner
(
User
(
'root'
),
attach_to_tap
=
True
)
computer_tap
.
createWithOwner
(
User
(
'root'
),
attach_to_tap
=
True
)
self
.
bridg
e
.
addTap
(
computer_tap
)
self
.
interfac
e
.
addTap
(
computer_tap
)
return
self
.
bridg
e
.
addAddr
()
return
self
.
interfac
e
.
addAddr
()
def
send
(
self
,
config
):
def
send
(
self
,
config
):
"""
"""
...
@@ -296,7 +296,7 @@ class Computer(object):
...
@@ -296,7 +296,7 @@ class Computer(object):
Construct the computer object as it is.
Construct the computer object as it is.
"""
"""
if
alter_network
and
self
.
address
is
not
None
:
if
alter_network
and
self
.
address
is
not
None
:
self
.
bridg
e
.
addAddr
(
self
.
address
,
self
.
netmask
)
self
.
interfac
e
.
addAddr
(
self
.
address
,
self
.
netmask
)
for
path
in
self
.
instance_root
,
self
.
software_root
:
for
path
in
self
.
instance_root
,
self
.
software_root
:
if
not
os
.
path
.
exists
(
path
):
if
not
os
.
path
.
exists
(
path
):
...
@@ -330,13 +330,13 @@ class Computer(object):
...
@@ -330,13 +330,13 @@ class Computer(object):
if
alter_network
:
if
alter_network
:
# In case it has to be attached to the TAP network device, only one
# In case it has to be attached to the TAP network device, only one
# is necessary for the
bridg
e to assert carrier
# is necessary for the
interfac
e to assert carrier
if
self
.
bridg
e
.
attach_to_tap
and
partition_index
==
0
:
if
self
.
interfac
e
.
attach_to_tap
and
partition_index
==
0
:
partition
.
tap
.
createWithOwner
(
owner
,
attach_to_tap
=
True
)
partition
.
tap
.
createWithOwner
(
owner
,
attach_to_tap
=
True
)
else
:
else
:
partition
.
tap
.
createWithOwner
(
owner
)
partition
.
tap
.
createWithOwner
(
owner
)
self
.
bridg
e
.
addTap
(
partition
.
tap
)
self
.
interfac
e
.
addTap
(
partition
.
tap
)
# Reconstructing partition's directory
# Reconstructing partition's directory
partition
.
createPath
(
alter_user
)
partition
.
createPath
(
alter_user
)
...
@@ -347,8 +347,8 @@ class Computer(object):
...
@@ -347,8 +347,8 @@ class Computer(object):
# * local IPv4, took from slapformat:ipv4_local_network
# * local IPv4, took from slapformat:ipv4_local_network
if
len
(
partition
.
address_list
)
==
0
:
if
len
(
partition
.
address_list
)
==
0
:
# regenerate
# regenerate
partition
.
address_list
.
append
(
self
.
bridg
e
.
addIPv4LocalAddress
())
partition
.
address_list
.
append
(
self
.
interfac
e
.
addIPv4LocalAddress
())
partition
.
address_list
.
append
(
self
.
bridg
e
.
addAddr
())
partition
.
address_list
.
append
(
self
.
interfac
e
.
addAddr
())
elif
alter_network
:
elif
alter_network
:
# regenerate list of addresses
# regenerate list of addresses
old_partition_address_list
=
partition
.
address_list
old_partition_address_list
=
partition
.
address_list
...
@@ -363,16 +363,16 @@ class Computer(object):
...
@@ -363,16 +363,16 @@ class Computer(object):
raise
ValueError
(
'Not valid ipv6 addresses loaded'
)
raise
ValueError
(
'Not valid ipv6 addresses loaded'
)
for
address
in
old_partition_address_list
:
for
address
in
old_partition_address_list
:
if
netaddr
.
valid_ipv6
(
address
[
'addr'
]):
if
netaddr
.
valid_ipv6
(
address
[
'addr'
]):
partition
.
address_list
.
append
(
self
.
bridg
e
.
addAddr
(
partition
.
address_list
.
append
(
self
.
interfac
e
.
addAddr
(
address
[
'addr'
],
address
[
'addr'
],
address
[
'netmask'
]))
address
[
'netmask'
]))
elif
netaddr
.
valid_ipv4
(
address
[
'addr'
]):
elif
netaddr
.
valid_ipv4
(
address
[
'addr'
]):
partition
.
address_list
.
append
(
self
.
bridg
e
.
addIPv4LocalAddress
(
partition
.
address_list
.
append
(
self
.
interfac
e
.
addIPv4LocalAddress
(
address
[
'addr'
]))
address
[
'addr'
]))
else
:
else
:
raise
ValueError
(
'Address %r is incorrect'
%
address
[
'addr'
])
raise
ValueError
(
'Address %r is incorrect'
%
address
[
'addr'
])
finally
:
finally
:
if
alter_network
and
self
.
bridg
e
.
attach_to_tap
:
if
alter_network
and
self
.
interfac
e
.
attach_to_tap
:
try
:
try
:
self
.
partition_list
[
0
].
tap
.
detach
()
self
.
partition_list
[
0
].
tap
.
detach
()
except
IndexError
:
except
IndexError
:
...
@@ -513,6 +513,7 @@ class Tap(object):
...
@@ -513,6 +513,7 @@ class Tap(object):
there is carrier, e.g. the network cable is plugged into a switch for
there is carrier, e.g. the network cable is plugged into a switch for
example).
example).
In case of bridge:
In order to be able to check the uniqueness of IPv6 address assigned to
In order to be able to check the uniqueness of IPv6 address assigned to
the bridge, the network interface must be up from an administrative *and*
the bridge, the network interface must be up from an administrative *and*
operational point of view.
operational point of view.
...
@@ -574,20 +575,20 @@ class Tap(object):
...
@@ -574,20 +575,20 @@ class Tap(object):
if
attach_to_tap
:
if
attach_to_tap
:
threading
.
Thread
(
target
=
self
.
attach
).
start
()
threading
.
Thread
(
target
=
self
.
attach
).
start
()
class
Bridg
e
(
object
):
class
Interfac
e
(
object
):
"
Bridge represent a bridg
e on the system"
"
Interface represent a interfac
e on the system"
def
__init__
(
self
,
name
,
ipv4_local_network
,
ipv6_interface
=
None
):
def
__init__
(
self
,
name
,
ipv4_local_network
,
ipv6_interface
=
None
):
"""
"""
Attributes:
Attributes:
name: String, the name of the
bridg
e
name: String, the name of the
interfac
e
"""
"""
self
.
name
=
str
(
name
)
self
.
name
=
str
(
name
)
self
.
ipv4_local_network
=
ipv4_local_network
self
.
ipv4_local_network
=
ipv4_local_network
self
.
ipv6_interface
=
ipv6_interface
self
.
ipv6_interface
=
ipv6_interface
# Attach to TAP network interface, only if the
bridg
e interface does not
# Attach to TAP network interface, only if the
interfac
e interface does not
# report carrier
# report carrier
_
,
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
]
...
@@ -630,19 +631,19 @@ class Bridge(object):
...
@@ -630,19 +631,19 @@ class Bridge(object):
return
address_list
return
address_list
def
getInterfaceList
(
self
):
def
getInterfaceList
(
self
):
"""Returns list of interfaces already present on
bridg
e"""
"""Returns list of interfaces already present on
interfac
e"""
interface_list
=
[]
interface_list
=
[]
_
,
result
=
callAndRead
([
'brctl'
,
'show'
])
_
,
result
=
callAndRead
([
'brctl'
,
'show'
])
in_
bridg
e
=
False
in_
interfac
e
=
False
for
line
in
result
.
split
(
'
\
n
'
):
for
line
in
result
.
split
(
'
\
n
'
):
if
len
(
line
.
split
())
>
1
:
if
len
(
line
.
split
())
>
1
:
if
self
.
name
in
line
:
if
self
.
name
in
line
:
interface_list
.
append
(
line
.
split
()[
-
1
])
interface_list
.
append
(
line
.
split
()[
-
1
])
in_
bridg
e
=
True
in_
interfac
e
=
True
continue
continue
if
in_
bridg
e
:
if
in_
interfac
e
:
break
break
elif
in_
bridg
e
:
elif
in_
interfac
e
:
if
line
.
strip
():
if
line
.
strip
():
interface_list
.
append
(
line
.
strip
())
interface_list
.
append
(
line
.
strip
())
...
@@ -659,7 +660,7 @@ class Bridge(object):
...
@@ -659,7 +660,7 @@ class Bridge(object):
callAndRead
([
'brctl'
,
'addif'
,
self
.
name
,
tap
.
name
])
callAndRead
([
'brctl'
,
'addif'
,
self
.
name
,
tap
.
name
])
def
_addSystemAddress
(
self
,
address
,
netmask
,
ipv6
=
True
):
def
_addSystemAddress
(
self
,
address
,
netmask
,
ipv6
=
True
):
"""Adds system address to
bridg
e
"""Adds system address to
interfac
e
Returns True if address was added successfully.
Returns True if address was added successfully.
...
@@ -739,16 +740,16 @@ class Bridge(object):
...
@@ -739,16 +740,16 @@ class Bridge(object):
def
addAddr
(
self
,
addr
=
None
,
netmask
=
None
):
def
addAddr
(
self
,
addr
=
None
,
netmask
=
None
):
"""
"""
Adds IP address to
bridg
e.
Adds IP address to
interfac
e.
If addr is specified and exists already on
bridg
e does nothing.
If addr is specified and exists already on
interfac
e does nothing.
If addr is specified and does not exists on
bridg
e, tries to add given
If addr is specified and does not exists on
interfac
e, tries to add given
address. If it is not possible (ex. because network changed) calculates new
address. If it is not possible (ex. because network changed) calculates new
address.
address.
Args:
Args:
addr: Wished address to be added to
bridg
e.
addr: Wished address to be added to
interfac
e.
netmask: Wished netmask to be used.
netmask: Wished netmask to be used.
Returns:
Returns:
...
@@ -756,33 +757,33 @@ class Bridge(object):
...
@@ -756,33 +757,33 @@ class Bridge(object):
Raises:
Raises:
AddressGenerationError: Couldn't construct valid address with existing
AddressGenerationError: Couldn't construct valid address with existing
one's on the
bridg
e.
one's on the
interfac
e.
NoAddressOn
Bridge: There's no address on the bridg
e to construct
NoAddressOn
Interface: There's no address on the interfac
e to construct
an address with.
an address with.
"""
"""
# Getting one address of the
bridg
e as base of the next addresses
# Getting one address of the
interfac
e as base of the next addresses
if
self
.
ipv6_interface
:
if
self
.
ipv6_interface
:
interface_name
=
self
.
ipv6_interface
interface_name
=
self
.
ipv6_interface
else
:
else
:
interface_name
=
self
.
name
interface_name
=
self
.
name
bridg
e_addr_list
=
self
.
getGlobalScopeAddressList
()
interfac
e_addr_list
=
self
.
getGlobalScopeAddressList
()
# No address found
# No address found
if
len
(
bridg
e_addr_list
)
==
0
:
if
len
(
interfac
e_addr_list
)
==
0
:
raise
NoAddressOn
Bridg
e
(
interface_name
)
raise
NoAddressOn
Interfac
e
(
interface_name
)
address_dict
=
bridg
e_addr_list
[
0
]
address_dict
=
interfac
e_addr_list
[
0
]
if
addr
is
not
None
:
if
addr
is
not
None
:
if
dict
(
addr
=
addr
,
netmask
=
netmask
)
in
bridg
e_addr_list
:
if
dict
(
addr
=
addr
,
netmask
=
netmask
)
in
interfac
e_addr_list
:
# confirmed to be configured
# confirmed to be configured
return
dict
(
addr
=
addr
,
netmask
=
netmask
)
return
dict
(
addr
=
addr
,
netmask
=
netmask
)
if
netmask
==
address_dict
[
'netmask'
]:
if
netmask
==
address_dict
[
'netmask'
]:
# same netmask, so there is a chance to add good one
# same netmask, so there is a chance to add good one
bridg
e_network
=
netaddr
.
ip
.
IPNetwork
(
'%s/%s'
%
(
address_dict
[
'addr'
],
interfac
e_network
=
netaddr
.
ip
.
IPNetwork
(
'%s/%s'
%
(
address_dict
[
'addr'
],
netmaskToPrefixIPv6
(
address_dict
[
'netmask'
])))
netmaskToPrefixIPv6
(
address_dict
[
'netmask'
])))
requested_network
=
netaddr
.
ip
.
IPNetwork
(
'%s/%s'
%
(
addr
,
requested_network
=
netaddr
.
ip
.
IPNetwork
(
'%s/%s'
%
(
addr
,
netmaskToPrefixIPv6
(
netmask
)))
netmaskToPrefixIPv6
(
netmask
)))
if
bridg
e_network
.
network
==
requested_network
.
network
:
if
interfac
e_network
.
network
==
requested_network
.
network
:
# same network, try to add
# same network, try to add
if
self
.
_addSystemAddress
(
addr
,
netmask
):
if
self
.
_addSystemAddress
(
addr
,
netmask
):
# succeed, return it
# succeed, return it
...
@@ -871,19 +872,19 @@ def run(config):
...
@@ -871,19 +872,19 @@ def run(config):
'software_user'
:
'slapsoft'
,
'software_user'
:
'slapsoft'
,
})
})
computer_definition
.
read
(
filepath
)
computer_definition
.
read
(
filepath
)
bridg
e
=
None
interfac
e
=
None
address
=
None
address
=
None
netmask
=
None
netmask
=
None
if
computer_definition
.
has_option
(
'computer'
,
'address'
):
if
computer_definition
.
has_option
(
'computer'
,
'address'
):
address
,
netmask
=
computer_definition
.
get
(
'computer'
,
address
,
netmask
=
computer_definition
.
get
(
'computer'
,
'address'
).
split
(
'/'
)
'address'
).
split
(
'/'
)
if
config
.
alter_network
and
config
.
bridg
e_name
is
not
None
\
if
config
.
alter_network
and
config
.
interfac
e_name
is
not
None
\
and
config
.
ipv4_local_network
is
not
None
:
and
config
.
ipv4_local_network
is
not
None
:
bridge
=
Bridge
(
config
.
bridg
e_name
,
config
.
ipv4_local_network
,
interface
=
Interface
(
config
.
interfac
e_name
,
config
.
ipv4_local_network
,
config
.
ipv6_interface
)
config
.
ipv6_interface
)
computer
=
Computer
(
computer
=
Computer
(
reference
=
config
.
computer_id
,
reference
=
config
.
computer_id
,
bridge
=
bridg
e
,
interface
=
interfac
e
,
addr
=
address
,
addr
=
address
,
netmask
=
netmask
,
netmask
=
netmask
,
ipv6_interface
=
config
.
ipv6_interface
,
ipv6_interface
=
config
.
ipv6_interface
,
...
@@ -914,8 +915,8 @@ def run(config):
...
@@ -914,8 +915,8 @@ def run(config):
config
.
computer_xml
,
))
config
.
computer_xml
,
))
computer
=
Computer
.
load
(
config
.
computer_xml
,
computer
=
Computer
.
load
(
config
.
computer_xml
,
reference
=
config
.
computer_id
,
ipv6_interface
=
config
.
ipv6_interface
)
reference
=
config
.
computer_id
,
ipv6_interface
=
config
.
ipv6_interface
)
# Connect to the
bridge
interface defined by the configuration
# Connect to the interface defined by the configuration
computer
.
bridge
=
Bridge
(
config
.
bridg
e_name
,
config
.
ipv4_local_network
,
computer
.
interface
=
Interface
(
config
.
interfac
e_name
,
config
.
ipv4_local_network
,
config
.
ipv6_interface
)
config
.
ipv6_interface
)
else
:
else
:
# If no pre-existent configuration found, creating a new computer object
# If no pre-existent configuration found, creating a new computer object
...
@@ -923,7 +924,7 @@ def run(config):
...
@@ -923,7 +924,7 @@ def run(config):
config
.
computer_id
,
))
config
.
computer_id
,
))
computer
=
Computer
(
computer
=
Computer
(
reference
=
config
.
computer_id
,
reference
=
config
.
computer_id
,
bridge
=
Bridge
(
config
.
bridg
e_name
,
config
.
ipv4_local_network
,
interface
=
Interface
(
config
.
interfac
e_name
,
config
.
ipv4_local_network
,
config
.
ipv6_interface
),
config
.
ipv6_interface
),
addr
=
None
,
addr
=
None
,
netmask
=
None
,
netmask
=
None
,
...
@@ -1043,7 +1044,7 @@ class Config(object):
...
@@ -1043,7 +1044,7 @@ class Config(object):
setattr
(
self
,
key
,
configuration_dict
[
key
])
setattr
(
self
,
key
,
configuration_dict
[
key
])
# setup some nones
# setup some nones
for
parameter
in
[
'
bridg
e_name'
,
'partition_base_name'
,
'user_base_name'
,
for
parameter
in
[
'
interfac
e_name'
,
'partition_base_name'
,
'user_base_name'
,
'tap_base_name'
,
'ipv4_local_network'
,
'ipv6_interface'
]:
'tap_base_name'
,
'ipv4_local_network'
,
'ipv6_interface'
]:
if
getattr
(
self
,
parameter
,
None
)
is
None
:
if
getattr
(
self
,
parameter
,
None
)
is
None
:
setattr
(
self
,
parameter
,
None
)
setattr
(
self
,
parameter
,
None
)
...
@@ -1147,12 +1148,12 @@ def main(*args):
...
@@ -1147,12 +1148,12 @@ def main(*args):
else
:
else
:
return
0
,
''
return
0
,
''
callAndRead
=
dry_callAndRead
callAndRead
=
dry_callAndRead
real_addSystemAddress
=
Bridg
e
.
_addSystemAddress
real_addSystemAddress
=
Interfac
e
.
_addSystemAddress
def
fake_addSystemAddress
(
*
args
,
**
kw
):
def
fake_addSystemAddress
(
*
args
,
**
kw
):
real_addSystemAddress
(
*
args
,
**
kw
)
real_addSystemAddress
(
*
args
,
**
kw
)
# Fake success
# Fake success
return
True
return
True
Bridg
e
.
_addSystemAddress
=
fake_addSystemAddress
Interfac
e
.
_addSystemAddress
=
fake_addSystemAddress
def
fake_getpwnam
(
user
):
def
fake_getpwnam
(
user
):
class
result
(
object
):
class
result
(
object
):
pw_uid
=
12345
pw_uid
=
12345
...
...
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