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
Boxiang Sun
slapos.package
Commits
f0367ce8
Commit
f0367ce8
authored
Aug 28, 2012
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added check on computer id in slaptest
parent
b8c5d522
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
slapos-node/slaptest
slapos-node/slaptest
+25
-1
No files found.
slapos-node/slaptest
View file @
f0367ce8
...
...
@@ -179,6 +179,27 @@ def check_networkcache_upload(config,logger,configuration_dict):
logger
.
critical
(
"No %s parameter in your file"
%
key
)
pass
def
get_computer_name
(
certificate
):
certificate
=
open
(
certificate
,
"r"
)
for
line
in
certificate
:
i
=
0
if
"Subject"
in
line
:
k
=
line
.
find
(
"COMP-"
)
i
=
line
.
find
(
"/email"
)
certificate
.
close
()
return
line
[
k
:
i
]
return
-
1
def
check_computer_id
(
logger
,
computer_id
,
cert_file
):
comp_cert
=
get_computer_name
(
cert_file
)
if
comp_cert
==
""
:
logger
.
error
(
"Certificate file indicated is corrupted (no computer id)"
)
elif
comp_cert
==
computer_id
:
logger
.
info
(
"Certificate and slapos.cfg define same computer id: %s"
%
computer_id
)
else
:
logger
.
critical
(
"Computers id from cerificate (%s) is different from slapos.cfg (%s)"
%
(
comp_cert
,
computer_id
))
def
slapos_conf_check
(
config
):
"""
...
...
@@ -194,7 +215,7 @@ def slapos_conf_check (config):
configuration_parser
=
ConfigParser
.
SafeConfigParser
()
configuration_parser
.
read
(
configuration_file_path
)
# Check if files for slapos and slapformat exists
for
section
in
(
"slap
format"
,
"slapos
"
):
for
section
in
(
"slap
os"
,
"slapformat
"
):
configuration_dict
=
dict
(
configuration_parser
.
items
(
section
))
for
key
in
configuration_dict
:
if
key
in
(
"key_file"
,
"cert_file"
,
"certificate_repository_path"
):
...
...
@@ -204,6 +225,9 @@ def slapos_conf_check (config):
%
(
files
,
key
))
else
:
logger
.
info
(
"%s parameter:%s does exists"
%
(
key
,
files
))
if
key
==
"cert_file"
:
check_computer_id
(
logger
,
configuration_dict
[
"computer_id"
],
configuration_dict
[
"cert_file"
])
# Check networkcache
check_networkcache
(
config
,
logger
,
configuration_parser
)
...
...
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