Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Joanne Hugé
slapos
Commits
bd4ad0f1
Commit
bd4ad0f1
authored
Apr 16, 2015
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix re6stnet log rotate, split certificate generation
parent
ffbac7a4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
12 deletions
+41
-12
slapos/recipe/re6stnet/__init__.py
slapos/recipe/re6stnet/__init__.py
+33
-11
slapos/recipe/re6stnet/template/registry-run.in
slapos/recipe/re6stnet/template/registry-run.in
+5
-0
software/re6stnet/instance-re6stnet.cfg.in
software/re6stnet/instance-re6stnet.cfg.in
+2
-0
software/re6stnet/software.cfg
software/re6stnet/software.cfg
+1
-1
No files found.
slapos/recipe/re6stnet/__init__.py
View file @
bd4ad0f1
...
@@ -29,7 +29,7 @@ import subprocess
...
@@ -29,7 +29,7 @@ import subprocess
from
slapos.recipe.librecipe
import
GenericBaseRecipe
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
socket
import
socket
import
struct
import
struct
import
os
import
os
,
stat
import
string
,
random
import
string
,
random
import
json
import
json
import
traceback
import
traceback
...
@@ -72,12 +72,18 @@ class Recipe(GenericBaseRecipe):
...
@@ -72,12 +72,18 @@ class Recipe(GenericBaseRecipe):
key_file
=
self
.
options
[
'key-file'
].
strip
()
key_file
=
self
.
options
[
'key-file'
].
strip
()
cert_file
=
self
.
options
[
'cert-file'
].
strip
()
cert_file
=
self
.
options
[
'cert-file'
].
strip
()
dh_file
=
self
.
options
[
'dh-file'
].
strip
()
dh_file
=
self
.
options
[
'dh-file'
].
strip
()
if
not
os
.
path
.
exists
(
key_file
):
if
not
os
.
path
.
exists
(
dh_file
):
serial
=
self
.
getSerialFromIpv6
(
self
.
options
[
'ipv6-prefix'
].
strip
())
dh_command
=
[
self
.
options
[
'openssl-bin'
],
'dhparam'
,
'-out'
,
dh_command
=
[
self
.
options
[
'openssl-bin'
],
'dhparam'
,
'-out'
,
'%s'
%
dh_file
,
self
.
options
[
'key-size'
]]
'%s'
%
dh_file
,
self
.
options
[
'key-size'
]]
try
:
subprocess
.
check_call
(
dh_command
)
except
Exception
:
if
os
.
path
.
exists
(
dh_file
):
os
.
unlink
(
dh_file
)
raise
if
not
os
.
path
.
exists
(
cert_file
):
serial
=
self
.
getSerialFromIpv6
(
self
.
options
[
'ipv6-prefix'
].
strip
())
key_command
=
[
self
.
options
[
'openssl-bin'
],
'genrsa'
,
'-out'
,
key_command
=
[
self
.
options
[
'openssl-bin'
],
'genrsa'
,
'-out'
,
'%s'
%
key_file
,
self
.
options
[
'key-size'
]]
'%s'
%
key_file
,
self
.
options
[
'key-size'
]]
...
@@ -86,9 +92,19 @@ class Recipe(GenericBaseRecipe):
...
@@ -86,9 +92,19 @@ class Recipe(GenericBaseRecipe):
'-x509'
,
'-batch'
,
'-key'
,
'%s'
%
key_file
,
'-set_serial'
,
'-x509'
,
'-batch'
,
'-key'
,
'%s'
%
key_file
,
'-set_serial'
,
'%s'
%
serial
,
'-days'
,
'3650'
,
'-out'
,
'%s'
%
cert_file
]
'%s'
%
serial
,
'-days'
,
'3650'
,
'-out'
,
'%s'
%
cert_file
]
subprocess
.
check_call
(
dh_command
)
try
:
subprocess
.
check_call
(
key_command
)
subprocess
.
check_call
(
key_command
)
except
Exception
:
if
os
.
path
.
exists
(
key_file
):
os
.
unlink
(
key_file
)
raise
try
:
subprocess
.
check_call
(
cert_command
)
subprocess
.
check_call
(
cert_command
)
except
Exception
:
if
os
.
path
.
exists
(
cert_file
):
os
.
unlink
(
cert_file
)
raise
def
generateSlaveTokenList
(
self
,
slave_instance_list
,
token_file
):
def
generateSlaveTokenList
(
self
,
slave_instance_list
,
token_file
):
to_remove_dict
=
{}
to_remove_dict
=
{}
...
@@ -150,9 +166,15 @@ class Recipe(GenericBaseRecipe):
...
@@ -150,9 +166,15 @@ class Recipe(GenericBaseRecipe):
self
.
generateCertificate
()
self
.
generateCertificate
()
wrapper
=
self
.
createWrapper
(
name
=
self
.
options
[
'wrapper'
],
wrapper
=
self
.
createFile
(
self
.
options
[
'wrapper'
],
self
.
substituteTemplate
(
command
=
self
.
options
[
'command'
],
self
.
getTemplateFilename
(
'registry-run.in'
),
dict
(
parameters
=
[
'@%s'
%
self
.
options
[
'config-file'
]])
parameter
=
'@%s'
%
self
.
options
[
'config-file'
],
pid_file
=
self
.
options
[
'pid-file'
],
command
=
self
.
options
[
'command'
]
)
)
)
os
.
chmod
(
self
.
options
[
'wrapper'
],
stat
.
S_IRWXU
)
path_list
.
append
(
wrapper
)
path_list
.
append
(
wrapper
)
...
...
slapos/recipe/re6stnet/template/registry-run.in
0 → 100644
View file @
bd4ad0f1
#!/bin/sh
echo
$$
>
%
(
pid_file
)
s
exec
%
(
command
)
s
\
%
(
parameter
)
s
\ No newline at end of file
software/re6stnet/instance-re6stnet.cfg.in
View file @
bd4ad0f1
...
@@ -123,6 +123,7 @@ context = section parameter_dict re6st-registry-conf-dict
...
@@ -123,6 +123,7 @@ context = section parameter_dict re6st-registry-conf-dict
recipe = slapos.cookbook:re6stnet.registry
recipe = slapos.cookbook:re6stnet.registry
command = {{ re6st_registry }}
command = {{ re6st_registry }}
wrapper = ${directory:services}/re6st-registry
wrapper = ${directory:services}/re6st-registry
pid-file = ${directory:run}/registry.pid
manager-wrapper = ${directory:bin}/re6stManageToken
manager-wrapper = ${directory:bin}/re6stManageToken
check-service-wrapper = ${directory:bin}/re6stCheckService
check-service-wrapper = ${directory:bin}/re6stCheckService
drop-service-wrapper = ${directory:bin}/re6stManageDeleteToken
drop-service-wrapper = ${directory:bin}/re6stManageDeleteToken
...
@@ -178,6 +179,7 @@ command = {{ python_bin }} ${re6st-registry:drop-service-wrapper}
...
@@ -178,6 +179,7 @@ command = {{ python_bin }} ${re6st-registry:drop-service-wrapper}
< = logrotate-entry-base
< = logrotate-entry-base
name = re6stnet
name = re6stnet
log = ${re6st-registry-conf-dict:logfile}
log = ${re6st-registry-conf-dict:logfile}
post = {{ parameter_dict['bin-directory'] }}/slapos-kill --pidfile ${re6st-registry:pid-file} -s USR1
[re6st-registry-promise]
[re6st-registry-promise]
recipe = slapos.cookbook:check_port_listening
recipe = slapos.cookbook:check_port_listening
...
...
software/re6stnet/software.cfg
View file @
bd4ad0f1
...
@@ -94,7 +94,7 @@ extra-context =
...
@@ -94,7 +94,7 @@ extra-context =
[template-re6stnet]
[template-re6stnet]
< = download-base
< = download-base
filename = instance-re6stnet.cfg.in
filename = instance-re6stnet.cfg.in
md5sum =
ff1242b9ed8295181e4a4178d480dbcb
md5sum =
c83fceedba8a817d49f8cf56bfbc2b83
[template-logrotate-base]
[template-logrotate-base]
< = template-jinja2-base
< = template-jinja2-base
...
...
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