Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
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
Carlos Ramos Carreño
slapos.package
Commits
dab41f46
Commit
dab41f46
authored
Mar 05, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor code.
parent
5c14a39e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
34 deletions
+28
-34
slapprepare/slapprepare/slapprepare.py
slapprepare/slapprepare/slapprepare.py
+28
-34
No files found.
slapprepare/slapprepare/slapprepare.py
View file @
dab41f46
...
...
@@ -505,7 +505,7 @@ def prepare_from_scratch(config):
computer_id
=
get_computer_name
(
os
.
path
.
join
(
'/'
,
slapos_configuration
,
'slapos.cfg'
))
print
"
$
Your Computer is : %s"
%
computer_id
print
"Your Computer is : %s"
%
computer_id
config
.
slaposConfig
(
mount_dir_path
=
'/'
,
slapos_configuration
=
slapos_configuration
,
...
...
@@ -555,48 +555,42 @@ def prepare_from_scratch(config):
def
chownSlaposDirectory
():
config
=
ConfigParser
.
RawConfigParser
()
# search slapos.cfg
slapos_path_configuration_old
=
"/etc/slapos/slapos.cfg"
slapos_path_configuration
=
"/etc/opt/slapos/slapos.cfg"
# check path slapos.cfg
if
os
.
path
.
isfile
(
slapos_path_configuration_old
)
==
True
:
path_slapos
=
"/etc/slapos/"
if
os
.
path
.
isfile
(
slapos_path_configuration
)
==
True
:
path_slapos
=
"/etc/opt/slapos/"
# deplacement the real folder
os
.
chdir
(
path_slapos
)
# read slapos.cfg
config
.
read
(
'slapos.cfg'
)
# Search slapos.cfg
slapos_configuration_file_path
=
"/etc/opt/slapos/slapos.cfg"
slapos_configuration_file_path_old
=
"/etc/slapos/slapos.cfg"
if
not
os
.
path
.
isfile
(
slapos_configuration_file_path
):
if
os
.
path
.
isfile
(
slapos_configuration_file_path_old
):
slapos_configuration_file_path
=
slapos_configuration_file_path_old
else
:
# No configuration found : returning
return
# Reading slapos paths from configuration file
config
.
read
(
slapos_configuration_file_path
)
slapos_slapgrid_instance
=
config
.
get
(
'slapos'
,
'instance_root'
)
slapos_slapgrid_software
=
config
.
get
(
'slapos'
,
'software_root'
)
slapformat_partition
=
config
.
get
(
'slapformat'
,
'partition_amount'
)
slapformat_partition_base_name
=
config
.
get
(
'slapformat'
,
'partition_base_name'
)
slapformat_user_base_name
=
config
.
get
(
'slapformat'
,
'user_base_name'
)
path
=
slapos_slapgrid_instance
print
"Changing owners of software directory and partitions directories…"
print
"Changing owners of software directory and partitions directories..."
# chown of partitions (/srv/slapgrid/slappart*)
for
i
in
range
(
int
(
slapformat_partition
)):
uid
=
getpwnam
(
'%s%s'
%
(
slapformat_user_base_name
,
i
)
)[
2
]
gid
=
getpwnam
(
'%s%s'
%
(
slapformat_user_base_name
,
i
)
)[
3
]
item
=
'%s%s'
%
(
slapformat_partition_base_name
,
i
)
itempath
=
os
.
path
.
join
(
path
,
item
)
itempath
=
os
.
path
.
join
(
slapos_slapgrid_instance
,
item
)
os
.
chown
(
itempath
,
uid
,
gid
)
for
i
in
range
(
int
(
slapformat_partition
)):
path
=
"%s/%s%s"
%
(
slapos_slapgrid_instance
,
slapformat_partition_base_name
,
i
)
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
slapos_slapgrid_instance
=
"%s/%s%s"
%
(
slapos_slapgrid_instance
,
slapformat_partition_base_name
,
i
)
for
root
,
dirs
,
files
in
os
.
walk
(
slapos_slapgrid_instance
):
for
items
in
dirs
,
files
:
for
item
in
items
:
if
not
os
.
path
.
islink
(
item
):
os
.
chown
(
os
.
path
.
join
(
root
,
item
),
getpwnam
(
'%s%s'
%
(
slapformat_user_base_name
,
i
)
)[
2
],
getpwnam
(
'%s%s'
%
(
slapformat_user_base_name
,
i
)
)[
3
])
path
=
slapos_slapgrid_software
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
# chown of software root (/opt/slapgrid)
for
root
,
dirs
,
files
in
os
.
walk
(
slapos_slapgrid_software
):
for
items
in
dirs
,
files
:
for
item
in
items
:
os
.
chown
(
os
.
path
.
join
(
root
,
item
),
getpwnam
(
'slapsoft'
)[
2
],
getpwnam
(
'slapsoft'
)[
3
])
...
...
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