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
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
efd7096e
Commit
efd7096e
authored
Feb 01, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor style
parent
9d731d8e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
slapos/format.py
slapos/format.py
+12
-13
No files found.
slapos/format.py
View file @
efd7096e
...
@@ -117,7 +117,8 @@ class AddressGenerationError(Exception):
...
@@ -117,7 +117,8 @@ class AddressGenerationError(Exception):
)
)
def
callAndRead
(
argument_list
,
raise_on_error
=
True
):
def
callAndRead
(
argument_list
,
raise_on_error
=
True
):
popen
=
subprocess
.
Popen
(
argument_list
,
stdout
=
subprocess
.
PIPE
,
popen
=
subprocess
.
Popen
(
argument_list
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
stderr
=
subprocess
.
STDOUT
)
result
=
popen
.
communicate
()[
0
]
result
=
popen
.
communicate
()[
0
]
if
raise_on_error
and
popen
.
returncode
!=
0
:
if
raise_on_error
and
popen
.
returncode
!=
0
:
...
@@ -204,7 +205,7 @@ class Computer(object):
...
@@ -204,7 +205,7 @@ class Computer(object):
False if the interface isn't available, else the list of the free addresses.
False if the interface isn't available, else the list of the free addresses.
"""
"""
if
self
.
interface
is
None
:
if
self
.
interface
is
None
:
return
dict
(
addr
=
self
.
address
,
netmask
=
self
.
netmask
)
return
{
'addr'
:
self
.
address
,
'netmask'
:
self
.
netmask
}
computer_partition_address_list
=
[]
computer_partition_address_list
=
[]
for
partition
in
self
.
partition_list
:
for
partition
in
self
.
partition_list
:
...
@@ -236,9 +237,8 @@ class Computer(object):
...
@@ -236,9 +237,8 @@ class Computer(object):
slap_instance
=
slap
.
slap
()
slap_instance
=
slap
.
slap
()
connection_dict
=
{}
connection_dict
=
{}
if
config
.
key_file
and
config
.
cert_file
:
if
config
.
key_file
and
config
.
cert_file
:
connection_dict
.
update
(
connection_dict
[
'key_file'
]
=
config
.
key_file
key_file
=
config
.
key_file
,
connection_dict
[
'cert_file'
]
=
config
.
cert_file
cert_file
=
config
.
cert_file
)
slap_instance
.
initializeConnection
(
config
.
master_url
,
slap_instance
.
initializeConnection
(
config
.
master_url
,
**
connection_dict
)
**
connection_dict
)
slap_computer
=
slap_instance
.
registerComputer
(
self
.
reference
)
slap_computer
=
slap_instance
.
registerComputer
(
self
.
reference
)
...
@@ -250,7 +250,6 @@ class Computer(object):
...
@@ -250,7 +250,6 @@ class Computer(object):
raise
slap
.
NotFoundError
(
"%s
\
n
ERROR : This SlapOS node is not recognised by "
raise
slap
.
NotFoundError
(
"%s
\
n
ERROR : This SlapOS node is not recognised by "
"SlapOS Master. Please make sure computer_id of slapos.cfg looks "
"SlapOS Master. Please make sure computer_id of slapos.cfg looks "
"like 'COMP-123' and is correct.
\
n
Error is : 404 Not Found."
%
error
)
"like 'COMP-123' and is correct.
\
n
Error is : 404 Not Found."
%
error
)
return
def
dump
(
self
,
path_to_xml
):
def
dump
(
self
,
path_to_xml
):
"""
"""
...
@@ -277,7 +276,7 @@ class Computer(object):
...
@@ -277,7 +276,7 @@ class Computer(object):
self
.
backup_xml
(
path_to_archive
,
path_to_xml
)
self
.
backup_xml
(
path_to_archive
,
path_to_xml
)
with
open
(
path_to_xml
,
'wb'
)
as
fout
:
with
open
(
path_to_xml
,
'wb'
)
as
fout
:
fout
.
write
(
new_pretty_xml
)
fout
.
write
(
new_pretty_xml
)
...
@@ -309,8 +308,8 @@ class Computer(object):
...
@@ -309,8 +308,8 @@ class Computer(object):
reference
=
reference
,
reference
=
reference
,
addr
=
dumped_dict
[
'address'
],
addr
=
dumped_dict
[
'address'
],
netmask
=
dumped_dict
[
'netmask'
],
netmask
=
dumped_dict
[
'netmask'
],
ipv6_interface
=
ipv6_interface
,
ipv6_interface
=
ipv6_interface
,
software_user
=
dumped_dict
.
get
(
'software_user'
,
'slapsoft'
),
software_user
=
dumped_dict
.
get
(
'software_user'
,
'slapsoft'
),
)
)
for
partition_dict
in
dumped_dict
[
'partition_list'
]:
for
partition_dict
in
dumped_dict
[
'partition_list'
]:
...
...
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