Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
erp5
Commits
bd35420c
Commit
bd35420c
authored
Oct 24, 2012
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use createWrapper() for dcron/notifier/pbs
parent
8679a6aa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
56 deletions
+56
-56
slapos/recipe/dcron.py
slapos/recipe/dcron.py
+11
-15
slapos/recipe/notifier.py
slapos/recipe/notifier.py
+39
-34
slapos/recipe/pbs.py
slapos/recipe/pbs.py
+6
-7
No files found.
slapos/recipe/dcron.py
View file @
bd35420c
...
...
@@ -33,26 +33,22 @@ class Recipe(GenericBaseRecipe):
def
install
(
self
):
self
.
logger
.
info
(
"Installing dcron..."
)
path_list
=
[]
options
=
self
.
options
script
=
self
.
createWrapper
(
name
=
options
[
'binary'
],
command
=
options
[
'dcrond-binary'
].
strip
(),
parameters
=
[
'-s'
,
options
[
'cron-entries'
],
'-c'
,
options
[
'crontabs'
],
'-t'
,
options
[
'cronstamps'
],
'-f'
,
'-l'
,
'5'
,
'-M'
,
options
[
'catcher'
]
])
cronstamps
=
self
.
options
[
'cronstamps'
]
cron_d
=
self
.
options
[
'cron-entries'
]
crontabs
=
self
.
options
[
'crontabs'
]
catcher
=
self
.
options
[
'catcher'
]
binary
=
self
.
options
[
'binary'
]
script
=
self
.
createPythonScript
(
binary
,
'slapos.recipe.librecipe.execute.execute'
,
[
self
.
options
[
'dcrond-binary'
].
strip
(),
'-s'
,
cron_d
,
'-c'
,
crontabs
,
'-t'
,
cronstamps
,
'-f'
,
'-l'
,
'5'
,
'-M'
,
catcher
]
)
path_list
.
append
(
script
)
self
.
logger
.
debug
(
'Main cron executable created at : %r'
,
script
)
self
.
logger
.
info
(
"dcron successfully installed."
)
return
path_list
return
[
script
]
...
...
slapos/recipe/notifier.py
View file @
bd35420c
...
...
@@ -31,16 +31,17 @@ from slapos.recipe.librecipe import GenericBaseRecipe
class
Recipe
(
GenericBaseRecipe
):
def
install
(
self
):
commandline
=
[
self
.
options
[
'server-binary'
]]
commandline
.
extend
([
'--callbacks'
,
self
.
options
[
'callbacks'
]])
commandline
.
extend
([
'--feeds'
,
self
.
options
[
'feeds'
]])
commandline
.
extend
([
'--equeue-socket'
,
self
.
options
[
'equeue-socket'
]])
commandline
.
append
(
self
.
options
[
'host'
])
commandline
.
append
(
self
.
options
[
'port'
])
options
=
self
.
options
script
=
self
.
createWrapper
(
name
=
options
[
'wrapper'
],
command
=
options
[
'server-binary'
],
parameters
=
[
'--callbacks'
,
options
[
'callbacks'
],
'--feeds'
,
options
[
'feeds'
],
'--equeue-socket'
,
options
[
'equeue-socket'
],
options
[
'host'
],
options
[
'port'
]
])
return
[
script
]
return
[
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
'slapos.recipe.librecipe.execute.execute'
,
commandline
)]
class
Callback
(
GenericBaseRecipe
):
...
...
@@ -57,36 +58,40 @@ class Callback(GenericBaseRecipe):
class
Notify
(
GenericBaseRecipe
):
def
createNotifier
(
self
,
notifier_binary
,
executable
,
wrapper
,
**
kwargs
):
if
not
os
.
path
.
exists
(
kwargs
[
'log'
]):
def
createNotifier
(
self
,
notifier_binary
,
wrapper
,
executable
,
log
,
title
,
notification_url
,
feed_url
):
if
not
os
.
path
.
exists
(
log
):
# Just a touch
open
(
kwargs
[
'log'
]
,
'w'
).
close
()
open
(
log
,
'w'
).
close
()
commandline
=
[
notifier_binary
,
'-l'
,
kwargs
[
'log'
],
'--title'
,
kwargs
[
'title'
],
'--feed'
,
kwargs
[
'feed_url'
],
'--notification-url'
]
parameters
=
[
'-l'
,
log
,
'--title'
,
title
,
'--feed'
,
feed_url
,
'--notification-url'
,
]
parameters
.
extend
(
notification_url
.
split
(
' '
))
parameters
.
extend
([
'--executable'
,
executable
])
commandline
.
extend
(
kwargs
[
'notification_url'
].
split
(
' '
))
commandline
.
extend
([
'--executable'
,
executable
])
return
self
.
createWrapper
(
name
=
wrapper
,
command
=
notifier_binary
,
parameters
=
parameters
)
return
self
.
createPythonScript
(
wrapper
,
'slapos.recipe.librecipe.execute.execute'
,
[
str
(
i
)
for
i
in
commandline
])
def
install
(
self
):
feedurl
=
self
.
unparseUrl
(
scheme
=
'http'
,
host
=
self
.
options
[
'host'
],
feed
_
url
=
self
.
unparseUrl
(
scheme
=
'http'
,
host
=
self
.
options
[
'host'
],
port
=
self
.
options
[
'port'
],
path
=
'/get/%s'
%
self
.
options
[
'name'
])
script
=
self
.
createNotifier
(
self
.
options
[
'notifier-binary'
],
wrapper
=
self
.
options
[
'wrapper'
],
executable
=
self
.
options
[
'executable'
],
log
=
os
.
path
.
join
(
self
.
options
[
'feeds'
],
self
.
options
[
'name'
]),
title
=
self
.
options
[
'title'
],
notification_url
=
self
.
options
[
'notify'
],
feed_url
=
feedurl
,
)
log
=
os
.
path
.
join
(
self
.
options
[
'feeds'
],
self
.
options
[
'name'
])
options
=
self
.
options
script
=
self
.
createNotifier
(
notifier_binary
=
options
[
'notifier-binary'
],
wrapper
=
options
[
'wrapper'
],
executable
=
options
[
'executable'
],
log
=
log
,
title
=
options
[
'title'
],
notification_url
=
options
[
'notify'
],
feed_url
=
feed_url
)
return
[
script
]
slapos/recipe/pbs.py
View file @
bd35420c
...
...
@@ -215,15 +215,14 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
else
:
command
=
[
self
.
options
[
'rdiffbackup-binary'
]]
self
.
logger
.
info
(
"Server mode"
)
command
.
extend
([
'--restrict'
,
self
.
options
[
'path'
]])
command
.
append
(
'--server'
)
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
'slapos.recipe.librecipe.execute.execute'
,
command
)
wrapper
=
self
.
createWrapper
(
name
=
self
.
options
[
'wrapper'
],
command
=
self
.
options
[
'rdiffbackup-binary'
],
parameters
=
[
'--restrict'
,
self
.
options
[
'path'
],
'--server'
])
path_list
.
append
(
wrapper
)
return
path_list
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