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
Cédric Le Ninivin
slapos
Commits
86c3b58f
Commit
86c3b58f
authored
Aug 07, 2015
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] Agent
parent
a7cf2ea1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
125 deletions
+107
-125
slapos/recipe/agent/__init__.py
slapos/recipe/agent/__init__.py
+0
-66
slapos/recipe/agent/catdatefile.py
slapos/recipe/agent/catdatefile.py
+0
-14
software/agent/agent.cfg.in
software/agent/agent.cfg.in
+12
-0
software/agent/configuration.template
software/agent/configuration.template
+1
-0
software/agent/instance-agent.cfg
software/agent/instance-agent.cfg
+41
-17
software/agent/software.cfg
software/agent/software.cfg
+53
-28
No files found.
slapos/recipe/agent/__init__.py
deleted
100644 → 0
View file @
a7cf2ea1
##############################################################################
#
# Copyright (c) 2012 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.
#
#############################################################################
import
zc.buildout
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
sys
class
Recipe
(
GenericBaseRecipe
):
def
install
(
self
):
path_list
=
[]
configuration_path
=
self
.
options
[
"config"
]
header
=
"""[DEFAULT]
master_url = %s
key = %s
cert = %s
max_install_duration = %s
max_uninstall_duration = %s
max_request_duration = %s
max_destroy_duration = %s
"""
%
(
self
.
options
[
"master-url"
],
"
\
n
"
.
join
(
self
.
options
[
"key"
].
split
(
"
\
n
"
)),
"
\
n
"
.
join
(
self
.
options
[
"cert"
].
split
(
"
\
n
"
)),
self
.
options
[
"default_max_install_duration"
],
self
.
options
[
"default_max_uninstall_duration"
],
self
.
options
[
"default_max_request_duration"
],
self
.
options
[
"default_max_destroy_duration"
])
with
open
(
configuration_path
,
"w"
)
as
configuration
:
configuration
.
write
(
header
+
self
.
options
[
"configuration"
])
path_list
.
append
(
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
'slapos.recipe.librecipe.execute.execute'
,
[
self
.
options
[
"agent_binary"
],
'--pidfile=%s'
%
self
.
options
[
"pidfile"
],
"--log=%s"
%
self
.
options
[
"log"
],
configuration_path
]))
path_list
.
append
(
configuration_path
)
return
path_list
slapos/recipe/agent/catdatefile.py
deleted
100644 → 0
View file @
a7cf2ea1
import
os
import
sys
import
time
def
catdatefile
(
args
):
directory
=
args
[
0
]
try
:
suffix
=
args
[
1
]
except
IndexError
:
suffix
=
'.log'
f
=
open
(
os
.
path
.
join
(
directory
,
time
.
strftime
(
'%Y-%m-%d.%H:%M.%s'
)
+
suffix
),
'aw'
)
for
line
in
sys
.
stdin
.
read
():
f
.
write
(
line
)
f
.
close
()
software/agent/agent.cfg.in
0 → 100644
View file @
86c3b58f
[agent]
master_url = ${slap-parameter:master_url}
key = ${user-key:output}
cert = ${user-certificate:output}
timeout = ${slap-parameter:timeout}
node_title = ${slap-parameter:node_title}
test_title = ${slap-parameter:test_title}
project_title = ${slap-parameter:project_title}
task_count = ${slap-parameter:task_count}
report_url = ${slap-parameter:report_url}
software/agent/configuration.template
0 → 100644
View file @
86c3b58f
${:content}
software/agent/instance-agent.cfg
View file @
86c3b58f
...
...
@@ -6,28 +6,52 @@ eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[directory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
run = $${:etc}/run
service = $${buildout:directory}/etc/service
run = $${buildout:directory}/etc/run
agentlog = $${buildout:directory}/var/log/agent
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
[instance]
recipe = slapos.cookbook:agent
agent_binary = ${buildout:directory}/bin/agent
pidfile = $${directory:srv}/agent.pid
log = $${directory:agentlog}/agent.log
wrapper = $${directory:run}/agent
config = $${directory:etc}/agent.cfg
master-url = $${slap-parameter:master-url}
key = $${slap-parameter:userkey}
cert = $${slap-parameter:usercertificate}
configuration = $${slap-parameter:configuration}
default_max_install_duration = $${slap-parameter:default_max_install_duration}
default_max_uninstall_duration = $${slap-parameter:default_max_uninstall_duration}
default_max_request_duration = $${slap-parameter:default_max_request_duration}
default_max_destroy_duration = $${slap-parameter:default_max_destroy_duration}
recipe = slapos.cookbook:wrapper
command-line =
${buildout:bin-directory}/agent
--pidfile=$${directory:srv}/agent.pid
--log=$${directory:agentlog}/agent.log
$${agent-cfg:output}
wrapper-path = $${directory:service}/agent
output = $${:wrapper-path}
[agent-cfg]
recipe = slapos.recipe.template
url = ${agent.cfg.in:output}
output = $${directory:etc}/agent.cfg
[user-key]
recipe = slapos.recipe.template
url = ${configuration.template:output}
output = $${directory:etc}/certificate.key
content = $${slap-parameter:user_key}
[user-certificate]
recipe = slapos.recipe.template
url = ${configuration.template:output}
output = $${directory:etc}/certificate.crt
content = $${slap-parameter:user_certificate}
[slap-parameter]
timeout = 3600
configuration_url =
user_key =
user_certificate =
master_url =
node_title =
test_title =
project_title =
task_count = 1
report_url =
software/agent/software.cfg
View file @
86c3b58f
...
...
@@ -4,40 +4,25 @@ extends =
../../component/git/buildout.cfg
../../stack/slapos.cfg
develop =
${:parts-directory}/slapos.cookbook-repository
${:parts-directory}/slapos.toolbox-repository
parts =
template
template-agent
slapos.cookbook-repository
slapos.toolbox-repository
check-recipe
slapos-cookbook
script
# Local development
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.git
branch = agent
git-executable = ${git:location}/bin/git
[slapos.toolbox-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.toolbox.git
branch = agent3
git-executable = ${git:location}/bin/git
[configuration.template]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/configuration.template
output = ${buildout:directory}/parts/configuration.template/configuration.template
md5sum = b9cf97ba7a70423119519337112adbd2
mode = 0644
[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command =
grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link;
grep parts ${buildout:develop-eggs-directory}/slapos.toolbox.egg-link
[agent.cfg.in]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/agent.cfg.in
output = ${buildout:directory}/parts/agent.cfg.in/agent.cfg.in
md5sum = 390c12441e813533d55c9f981e8162b6
mode = 0644
[template]
recipe = slapos.recipe.template
...
...
@@ -50,7 +35,7 @@ mode = 0644
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-agent.cfg
output = ${buildout:directory}/template-agent.cfg
md5sum =
7c5c43eb98d5a11961d72fce97a8e67b
md5sum =
19c6387fd0d542fd1d7b01e3445f6735
mode = 0644
[script]
...
...
@@ -60,3 +45,43 @@ eggs =
slapos.core
slapos.toolbox[agent]
erp5.util
[versions]
apache-libcloud = 0.17.0
ecdsa = 0.13
erp5.util = 0.4.42
gitdb = 0.6.4
pycrypto = 2.6.1
slapos.recipe.download = 1.0
slapos.recipe.template = 2.8
slapos.toolbox = 0.50
smmap = 0.9.0
# Required by:
# slapos.toolbox==0.50
GitPython = 1.0.1
# Required by:
# slapos.toolbox==0.50
atomize = 0.2.0
# Required by:
# apache-libcloud==0.17.0
backports.ssl-match-hostname = 3.4.0.2
# Required by:
# slapos.toolbox==0.50
feedparser = 5.2.1
# Required by:
# slapos.toolbox==0.50
lockfile = 0.10.2
# Required by:
# slapos.toolbox==0.50
paramiko = 1.15.2
# Required by:
# slapos.toolbox==0.50
rpdb = 0.1.5
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