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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Klaus Wölfel
slapos
Commits
f9f68dd0
Commit
f9f68dd0
authored
Jun 01, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First release of standalone memcached recipe
parent
bac17cdc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
0 deletions
+90
-0
slapos/recipe/README.memcached.txt
slapos/recipe/README.memcached.txt
+4
-0
slapos/recipe/memcached/__init__.py
slapos/recipe/memcached/__init__.py
+84
-0
slapos/recipe/memcached/template/memcached.in
slapos/recipe/memcached/template/memcached.in
+2
-0
No files found.
slapos/recipe/README.memcached.txt
0 → 100644
View file @
f9f68dd0
memcached
=========
Instantiates Memcached instance.
slapos/recipe/memcached/__init__.py
0 → 100644
View file @
f9f68dd0
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
slapos.lib.recipe.BaseSlapRecipe
import
BaseSlapRecipe
import
os
import
pkg_resources
import
zc.buildout
import
zc.recipe.egg
class
Recipe
(
BaseSlapRecipe
):
def
getTemplateFilename
(
self
,
template_name
):
return
pkg_resources
.
resource_filename
(
__name__
,
'template/%s'
%
template_name
)
def
_install
(
self
):
self
.
path_list
=
[]
self
.
requirements
,
self
.
ws
=
self
.
egg
.
working_set
([
__name__
])
# XXX-Cedric : add logrotate?
memcached_conf
=
self
.
installMemcached
(
ip
=
self
.
getLocalIPv4Address
(),
port
=
11000
)
self
.
linkBinary
()
self
.
setConnectionDict
(
dict
(
url
=
memcached_conf
[
'memcached_url'
],
))
return
self
.
path_list
def
linkBinary
(
self
):
"""Links binaries to instance's bin directory for easier exposal"""
for
linkline
in
self
.
options
.
get
(
'link_binary_list'
,
''
).
splitlines
():
if
not
linkline
:
continue
target
=
linkline
.
split
()
if
len
(
target
)
==
1
:
target
=
target
[
0
]
path
,
linkname
=
os
.
path
.
split
(
target
)
else
:
linkname
=
target
[
1
]
target
=
target
[
0
]
link
=
os
.
path
.
join
(
self
.
bin_directory
,
linkname
)
if
os
.
path
.
lexists
(
link
):
if
not
os
.
path
.
islink
(
link
):
raise
zc
.
buildout
.
UserError
(
'Target link already %r exists but it is not link'
%
link
)
os
.
unlink
(
link
)
os
.
symlink
(
target
,
link
)
self
.
logger
.
debug
(
'Created link %r -> %r'
%
(
link
,
target
))
self
.
path_list
.
append
(
link
)
def
installMemcached
(
self
,
ip
,
port
):
config
=
dict
(
memcached_binary
=
self
.
options
[
'memcached_binary'
],
memcached_ip
=
ip
,
memcached_port
=
port
,
)
self
.
path_list
.
append
(
self
.
createRunningWrapper
(
'memcached'
,
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'memcached.in'
),
config
)))
return
dict
(
memcached_url
=
'%s:%s'
%
(
config
[
'memcached_ip'
],
config
[
'memcached_port'
]),
memcached_ip
=
config
[
'memcached_ip'
],
memcached_port
=
config
[
'memcached_port'
])
slapos/recipe/memcached/template/memcached.in
0 → 100644
View file @
f9f68dd0
#!/bin/sh
exec
%
(
memcached_binary
)
s
-p
%
(
memcached_port
)
s
-U
%
(
memcached_port
)
s
-l
%
(
memcached_ip
)
s
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