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
Justin
slapos
Commits
569439d5
Commit
569439d5
authored
Mar 22, 2020
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resilient: fix notifier.callback parts installing the same path
parent
58f40553
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
18 additions
and
43 deletions
+18
-43
setup.py
setup.py
+1
-1
slapos/recipe/librecipe/generic.py
slapos/recipe/librecipe/generic.py
+0
-16
slapos/recipe/notifier.py
slapos/recipe/notifier.py
+5
-9
software/slaprunner/buildout.hash.cfg
software/slaprunner/buildout.hash.cfg
+1
-1
software/slaprunner/instance-runner-import.cfg.in
software/slaprunner/instance-runner-import.cfg.in
+0
-2
stack/resilient/README.rst
stack/resilient/README.rst
+1
-1
stack/resilient/buildout.hash.cfg
stack/resilient/buildout.hash.cfg
+1
-1
stack/resilient/pbsready-import.cfg.in
stack/resilient/pbsready-import.cfg.in
+8
-11
stack/slapos.cfg
stack/slapos.cfg
+1
-1
No files found.
setup.py
View file @
569439d5
...
@@ -28,7 +28,7 @@ from setuptools import setup, find_packages
...
@@ -28,7 +28,7 @@ from setuptools import setup, find_packages
import
glob
import
glob
import
os
import
os
version
=
'1.0.14
2
'
version
=
'1.0.14
3
'
name
=
'slapos.cookbook'
name
=
'slapos.cookbook'
long_description
=
open
(
"README.rst"
).
read
()
long_description
=
open
(
"README.rst"
).
read
()
...
...
slapos/recipe/librecipe/generic.py
View file @
569439d5
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#
#
##############################################################################
##############################################################################
import
errno
import
errno
import
io
import
logging
import
logging
import
os
import
os
import
sys
import
sys
...
@@ -124,21 +123,6 @@ class GenericBaseRecipe(object):
...
@@ -124,21 +123,6 @@ class GenericBaseRecipe(object):
def
createExecutable
(
self
,
name
,
content
,
mode
=
0o700
):
def
createExecutable
(
self
,
name
,
content
,
mode
=
0o700
):
return
self
.
createFile
(
name
,
content
,
mode
)
return
self
.
createFile
(
name
,
content
,
mode
)
def
addLineToFile
(
self
,
filepath
,
line
,
encoding
=
'utf8'
):
"""Append a single line to a text file, if the line does not exist yet.
line must be unicode."""
if
os
.
path
.
exists
(
filepath
):
lines
=
[
l
.
rstrip
(
'
\
n
'
)
for
l
in
io
.
open
(
filepath
,
'r'
,
encoding
=
encoding
)]
else
:
lines
=
[]
if
not
line
in
lines
:
lines
.
append
(
line
)
with
io
.
open
(
filepath
,
'w+'
,
encoding
=
encoding
)
as
f
:
f
.
write
(
u'
\
n
'
.
join
(
lines
))
def
createPythonScript
(
self
,
name
,
absolute_function
,
args
=
(),
kw
=
{}):
def
createPythonScript
(
self
,
name
,
absolute_function
,
args
=
(),
kw
=
{}):
"""Create a python script using zc.buildout.easy_install.scripts
"""Create a python script using zc.buildout.easy_install.scripts
...
...
slapos/recipe/notifier.py
View file @
569439d5
...
@@ -46,20 +46,16 @@ class Recipe(GenericBaseRecipe):
...
@@ -46,20 +46,16 @@ class Recipe(GenericBaseRecipe):
class
Callback
(
GenericBaseRecipe
):
class
Callback
(
GenericBaseRecipe
):
def
createCallback
(
self
,
notification_id
,
callback
):
def
install
(
self
):
options
=
self
.
options
notification_id
=
options
[
'on-notification-id'
]
# XXX: hashing the name here and in
# XXX: hashing the name here and in
# slapos.toolbox/slapos/pubsub/__init__.py is completely messed up and
# slapos.toolbox/slapos/pubsub/__init__.py is completely messed up and
# prevent any debug.
# prevent any debug.
callback_id
=
sha512
(
str2bytes
(
notification_id
)).
hexdigest
()
callback_id
=
sha512
(
str2bytes
(
notification_id
)).
hexdigest
()
filepath
=
os
.
path
.
join
(
self
.
options
[
'callbacks'
],
callback_id
)
return
self
.
createFile
(
os
.
path
.
join
(
options
[
'directory'
],
callback_id
),
self
.
addLineToFile
(
filepath
,
callback
)
options
[
'callbacks'
])
return
filepath
def
install
(
self
):
# XXX this path is returned multiple times, one for each callback that has been added.
return
[
self
.
createCallback
(
self
.
options
[
'on-notification-id'
],
self
.
options
[
'callback'
])]
class
Notify
(
GenericBaseRecipe
):
class
Notify
(
GenericBaseRecipe
):
...
...
software/slaprunner/buildout.hash.cfg
View file @
569439d5
...
@@ -26,7 +26,7 @@ md5sum = 2852689640b632fc713d7a603ce66207
...
@@ -26,7 +26,7 @@ md5sum = 2852689640b632fc713d7a603ce66207
[instance-runner-import]
[instance-runner-import]
filename = instance-runner-import.cfg.in
filename = instance-runner-import.cfg.in
md5sum =
9a3adacb4a833b1af3715e7097d31aad
md5sum =
a582be15f0fb797fc75cfc39cd1d12ab
[instance-runner-export]
[instance-runner-export]
filename = instance-runner-export.cfg.in
filename = instance-runner-export.cfg.in
...
...
software/slaprunner/instance-runner-import.cfg.in
View file @
569439d5
...
@@ -29,8 +29,6 @@ parts +=
...
@@ -29,8 +29,6 @@ parts +=
software-release-deployment-promise
software-release-deployment-promise
resilient-software-release-information
resilient-software-release-information
# have to repeat the next one, as it's not inherited from pbsready-import
import-on-notification
monitor-base
monitor-base
...
...
stack/resilient/README.rst
View file @
569439d5
...
@@ -94,7 +94,7 @@ extends = ${instance-mysoftware:output}
...
@@ -94,7 +94,7 @@ extends = ${instance-mysoftware:output}
parts +=
parts +=
mysoftware
mysoftware
import-on-notification
notify-callback
[importer]
[importer]
recipe = YourImportRecipe
recipe = YourImportRecipe
...
...
stack/resilient/buildout.hash.cfg
View file @
569439d5
...
@@ -18,7 +18,7 @@ md5sum = 66331047b7dbf2513c5726d5d1647320
...
@@ -18,7 +18,7 @@ md5sum = 66331047b7dbf2513c5726d5d1647320
[pbsready-import]
[pbsready-import]
filename = pbsready-import.cfg.in
filename = pbsready-import.cfg.in
md5sum =
d813c43ed00eff868fb13bc75b045336
md5sum =
6f32cede10cf0d6430c017f49fe5aa30
[pbsready-export]
[pbsready-export]
filename = pbsready-export.cfg.in
filename = pbsready-export.cfg.in
...
...
stack/resilient/pbsready-import.cfg.in
View file @
569439d5
...
@@ -7,8 +7,7 @@ parts +=
...
@@ -7,8 +7,7 @@ parts +=
resilient-web-takeover-httpd-wrapper
resilient-web-takeover-httpd-wrapper
resilient-web-takeover-httpd-promise
resilient-web-takeover-httpd-promise
check-backup-integrity-on-notification
notify-callback
import-on-notification
backup-checksum-integrity-promise
backup-checksum-integrity-promise
resilient-publish-connection-parameter
resilient-publish-connection-parameter
...
@@ -39,13 +38,17 @@ minimum = 65516
...
@@ -39,13 +38,17 @@ minimum = 65516
maximum = 65525
maximum = 65525
ip = $${notifier:host}
ip = $${notifier:host}
[
import-on-notification
]
[
notify-callback
]
# notifier.callback runs a script when a notification (sent by a parent PBS)
# notifier.callback runs a script when a notification (sent by a parent PBS)
# is received
# is received
<= notifier
recipe = slapos.cookbook:notifier.callback
recipe = slapos.cookbook:notifier.callback
directory = $${notifier:callbacks}
on-notification-id = $${slap-parameter:on-notification}
on-notification-id = $${slap-parameter:on-notification}
callback = $${importer:wrapper}
callbacks =
# import on notification
$${importer:wrapper}
# check backup integrity on notification
$${post-notification-run:output}
[post-notification-run]
[post-notification-run]
recipe = collective.recipe.template
recipe = collective.recipe.template
...
@@ -59,12 +62,6 @@ input = inline:
...
@@ -59,12 +62,6 @@ input = inline:
output = $${rootdirectory:bin}/post-notification-run
output = $${rootdirectory:bin}/post-notification-run
mode = 0700
mode = 0700
[check-backup-integrity-on-notification]
<= notifier
recipe = slapos.cookbook:notifier.callback
on-notification-id = $${slap-parameter:on-notification}
callback = $${post-notification-run:output}
[backup-checksum-integrity-promise-bin]
[backup-checksum-integrity-promise-bin]
recipe = slapos.recipe.template:jinja2
recipe = slapos.recipe.template:jinja2
template = inline:
template = inline:
...
...
stack/slapos.cfg
View file @
569439d5
...
@@ -137,7 +137,7 @@ pyparsing = 2.2.0
...
@@ -137,7 +137,7 @@ pyparsing = 2.2.0
pytz = 2016.10
pytz = 2016.10
requests = 2.13.0
requests = 2.13.0
six = 1.12.0
six = 1.12.0
slapos.cookbook = 1.0.14
2
slapos.cookbook = 1.0.14
3
slapos.core = 1.5.9
slapos.core = 1.5.9
slapos.extension.strip = 0.4
slapos.extension.strip = 0.4
slapos.extension.shared = 1.0
slapos.extension.shared = 1.0
...
...
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