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
Xiaowu Zhang
slapos.core
Commits
7a476f87
Commit
7a476f87
authored
Jan 23, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
De-hardcode software instance owner.
parent
347dc0ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
slapos/format.py
slapos/format.py
+15
-6
No files found.
slapos/format.py
View file @
7a476f87
...
@@ -162,7 +162,7 @@ class Computer(object):
...
@@ -162,7 +162,7 @@ class Computer(object):
software_root
=
None
software_root
=
None
def
__init__
(
self
,
reference
,
bridge
=
None
,
addr
=
None
,
netmask
=
None
,
def
__init__
(
self
,
reference
,
bridge
=
None
,
addr
=
None
,
netmask
=
None
,
ipv6_interface
=
None
):
ipv6_interface
=
None
,
software_user
=
'slapsoft'
):
"""
"""
Attributes:
Attributes:
reference: String, the reference of the computer.
reference: String, the reference of the computer.
...
@@ -174,6 +174,7 @@ class Computer(object):
...
@@ -174,6 +174,7 @@ class Computer(object):
self
.
address
=
addr
self
.
address
=
addr
self
.
netmask
=
netmask
self
.
netmask
=
netmask
self
.
ipv6_interface
=
ipv6_interface
self
.
ipv6_interface
=
ipv6_interface
self
.
software_user
=
software_user
def
__getinitargs__
(
self
):
def
__getinitargs__
(
self
):
return
(
self
.
reference
,
self
.
bridge
)
return
(
self
.
reference
,
self
.
bridge
)
...
@@ -261,6 +262,7 @@ class Computer(object):
...
@@ -261,6 +262,7 @@ class Computer(object):
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'
),
)
)
for
partition_dict
in
dumped_dict
[
'partition_list'
]:
for
partition_dict
in
dumped_dict
[
'partition_list'
]:
...
@@ -302,8 +304,8 @@ class Computer(object):
...
@@ -302,8 +304,8 @@ class Computer(object):
else
:
else
:
os
.
chmod
(
path
,
0755
)
os
.
chmod
(
path
,
0755
)
# own self.software_root by s
lapsoft
# own self.software_root by s
oftware user
slapsoft
=
User
(
'slapsoft'
)
slapsoft
=
User
(
self
.
software_user
)
slapsoft
.
path
=
self
.
software_root
slapsoft
.
path
=
self
.
software_root
if
alter_user
:
if
alter_user
:
slapsoft
.
create
()
slapsoft
.
create
()
...
@@ -865,7 +867,9 @@ def run(config):
...
@@ -865,7 +867,9 @@ def run(config):
if
config
.
input_definition_file
:
if
config
.
input_definition_file
:
filepath
=
os
.
path
.
abspath
(
config
.
input_definition_file
)
filepath
=
os
.
path
.
abspath
(
config
.
input_definition_file
)
config
.
logger
.
info
(
'Using definition file %r'
%
filepath
)
config
.
logger
.
info
(
'Using definition file %r'
%
filepath
)
computer_definition
=
ConfigParser
.
RawConfigParser
()
computer_definition
=
ConfigParser
.
RawConfigParser
({
'software_user'
:
'slapsoft'
,
})
computer_definition
.
read
(
filepath
)
computer_definition
.
read
(
filepath
)
bridge
=
None
bridge
=
None
address
=
None
address
=
None
...
@@ -882,7 +886,8 @@ def run(config):
...
@@ -882,7 +886,8 @@ def run(config):
bridge
=
bridge
,
bridge
=
bridge
,
addr
=
address
,
addr
=
address
,
netmask
=
netmask
,
netmask
=
netmask
,
ipv6_interface
=
config
.
ipv6_interface
ipv6_interface
=
config
.
ipv6_interface
,
software_user
=
computer_definition
.
get
(
'computer'
,
'software_user'
),
)
)
partition_list
=
[]
partition_list
=
[]
for
partition_number
in
range
(
int
(
config
.
partition_amount
)):
for
partition_number
in
range
(
int
(
config
.
partition_amount
)):
...
@@ -922,7 +927,8 @@ def run(config):
...
@@ -922,7 +927,8 @@ def run(config):
config
.
ipv6_interface
),
config
.
ipv6_interface
),
addr
=
None
,
addr
=
None
,
netmask
=
None
,
netmask
=
None
,
ipv6_interface
=
config
.
ipv6_interface
ipv6_interface
=
config
.
ipv6_interface
,
software_user
=
config
.
software_user
,
)
)
partition_amount
=
int
(
config
.
partition_amount
)
partition_amount
=
int
(
config
.
partition_amount
)
...
@@ -1000,6 +1006,7 @@ class Config(object):
...
@@ -1000,6 +1006,7 @@ class Config(object):
verbose
=
None
verbose
=
None
dry_run
=
None
dry_run
=
None
console
=
None
console
=
None
software_user
=
None
@
staticmethod
@
staticmethod
def
checkRequiredBinary
(
binary_list
):
def
checkRequiredBinary
(
binary_list
):
...
@@ -1046,6 +1053,8 @@ class Config(object):
...
@@ -1046,6 +1053,8 @@ class Config(object):
self
.
alter_network
=
'True'
self
.
alter_network
=
'True'
if
self
.
alter_user
is
None
:
if
self
.
alter_user
is
None
:
self
.
alter_user
=
'True'
self
.
alter_user
=
'True'
if
self
.
software_user
is
None
:
self
.
software_user
=
'slapsoft'
# set up logging
# set up logging
self
.
logger
=
logging
.
getLogger
(
"slapformat"
)
self
.
logger
=
logging
.
getLogger
(
"slapformat"
)
...
...
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