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
8cd32a72
Commit
8cd32a72
authored
12 years ago
by
Yingjie Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SlapOS Test Agent Packaging.
parent
6b7b7774
master
1.0
arnau
asterisk
cedric.ln-erp5-cluster
cloudooo
cloudooo-clusterise-split
cygwin
cygwin-0
cygwin-res-resstack
davstorage-ajaxplorer
dream
drupal
erp5
erp5-cluster
erp5-cluster-monitoring
erp5-cluster-scalability
erp5-cluster-z2.13
erp5-cluster-z2.13-scalability
erp5-cluster-z2.13-scalability-N
erp5-component
erp5-component-libressl
erp5-component-subversion-1.7
erp5-component-subversion-1.8
erp5-component-z2.12
erp5-frontend
erp5-mysql-insecure-password
erp5-postfix
erp5-rkm
erp5-scikit
erp5-split-tidstorage
erp5-vifib
erp5-z2.12
erp5_kernel_jupyter
erp5testnode-scalability
erp5testnode-scalability-rebase-erp5testnode
erp5testnode-seb
erp5testnode_newfirefox
etherpad-lite
frontend-monitor-slave-configuration
gcc-4.7
gitlab-test
gitlab-test-8.6.1
glpi
grid-computing
hexaglobe-watermarking
hexaglobe-watermarking-replicated
html5as
improved-hello-world
ipnb_st
ipython
ipython_notebook
ivan
jupyter_wendelin
jwt
kvm-iaas
lamp-edge-jinja
mac
manual-kvm
mkr
monitor-stack
new-frontend
officejs_testrunner
openblas-make-ext-options
openstack
palo
palo_etl_wip
postfix
postgres
rafael_agent
re6st-master
reafs/heads/ipython
request-recipe
scikit-notmerge
shebang_limitation
shellinabox_password_promise_delay
slapos-master-cluster
slappromise
slapprunner-shellinabox-wip
slaprunner
systematic
systematic-nginx
testnode_software_link
ttrm
varnish
webrunner.custom-personal
wendelin_notebook
wipapi
wordpress-nginx
zabbix-upload-monitor
zerovm
zerovm-test
zimbra
zimbra-kvm
1.0.30
1.0.29
1.0.28
1.0.27
1.0.26
1.0.25
1.0.24
1.0.23
1.0.22
1.0.21
1.0.20
1.0.19
1.0.18
1.0.17
1.0.16
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8.1
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
vifib-20150331
vifib-20150203
vifib-20150130
vifib-20150123
vifib-20150116
vifib-20141222
vifib-20141119
slaprunner-resilient-v1
slaprunner-resilient-v1-RC1
slapos.core-1.0.0rc6-1
slapos.cookbook-0.103
slapos.cookbook-0.102
slapos.cookbook-0.101
slapos.cookbook-0.100
slapos.cookbook-0.99
slapos.cookbook-0.98
slapos.cookbook-0.97
slapos.cookbook-0.96
slapos.cookbook-0.95
slapos.cookbook-0.94
slapos.cookbook-0.93
slapos.cookbook-0.92
slapos.cookbook-0.91
slapos.cookbook-0.90
slapos.cookbook-0.89
slapos.cookbook-0.88
slapos.cookbook-0.87
slapos.cookbook-0.86
slapos.cookbook-0.85
slapos.cookbook-0.84.2
slapos.cookbook-0.84.1
slapos.cookbook-0.84
slapos.cookbook-0.83.1
slapos.cookbook-0.83
slapos.cookbook-0.82
slapos.cookbook-0.81
slapos.cookbook-0.80
slapos.cookbook-0.79
slapos.cookbook-0.78.5
slapos.cookbook-0.78.4
slapos.cookbook-0.78.3
slapos.cookbook-0.78.2
slapos.cookbook-0.78.1
slapos.cookbook-0.78.0
slapos.cookbook-0.77.1
slapos.cookbook-0.77.0
slapos.cookbook-0.76.0
slapos.cookbook-0.75.0
slapos.cookbook-0.74.0
slapos.cookbook-0.73.1
slapos.cookbook-0.72.0
slapos.cookbook-0.71.4
slapos.cookbook-0.71.3
slapos.cookbook-0.71.2
slapos.cookbook-0.71.1
slapos.cookbook-0.71
slapos.cookbook-0.70
slapos.cookbook-0.69
slapos.cookbook-0.68.1
slapos.cookbook-0.68
slapos.cookbook-0.67
slapos.cookbook-0.66
slapos.cookbook-0.64.2
slapos.cookbook-0.64.1
slapos.cookbook-0.64
slapos.cookbook-0.63
slapos.cookbook-0.62
slapos.cookbook-0.61
slapos.cookbook-0.60
slapos.cookbook-0.59
slapos.cookbook-0.58
slapos.cookbook-0.57
slapos.cookbook-0.55
slapos.cookbook-0.54.1
slapos.cookbook-0.54
slapos.cookbook-0.53
slapos.cookbook-0.51
slapos.cookbook-0.50
slapos.cookbook-0.49
slapos.cookbook-0.48
slapos.cookbook-0.47
slapos-legacy-flask-stack
slapos-159
slapos-0.271
slapos-0.270
slapos-0.269
slapos-0.268
slapos-0.267
slapos-0.266
slapos-0.265
slapos-0.264
slapos-0.263
slapos-0.262
slapos-0.261
slapos-0.260
slapos-0.259.2
slapos-0.259.1
slapos-0.259
slapos-0.258
slapos-0.257
slapos-0.256
slapos-0.255
slapos-0.254
slapos-0.253.3
slapos-0.253.2
slapos-0.253.1
slapos-0.253
slapos-0.252.1
slapos-0.252
slapos-0.251
slapos-0.250.2
slapos-0.250.1
slapos-0.250
slapos-0.249.1
slapos-0.249
slapos-0.248.1
slapos-0.248
slapos-0.247.1
slapos-0.247
slapos-0.246
slapos-0.245
slapos-0.244
slapos-0.243
slapos-0.242
slapos-0.241
slapos-0.240.0
slapos-0.240
slapos-0.239
slapos-0.238
slapos-0.237
slapos-0.236
slapos-0.235
slapos-0.234
slapos-0.233
slapos-0.232
slapos-0.231
slapos-0.230
slapos-0.229
slapos-0.228
slapos-0.227
slapos-0.226
slapos-0.225
slapos-0.224
slapos-0.223.1
slapos-0.223
slapos-0.222
slapos-0.221
slapos-0.220
slapos-0.219
slapos-0.218.2
slapos-0.218.1
slapos-0.218
slapos-0.217
slapos-0.217-B1
slapos-0.216
slapos-0.215
slapos-0.214
slapos-0.213
slapos-0.212
slapos-0.211
slapos-0.210
slapos-0.209
slapos-0.208
slapos-0.207
slapos-0.206
slapos-0.205
slapos-0.204
slapos-0.203
slapos-0.202
slapos-0.201
slapos-0.200
slapos-0.199
slapos-0.199-hotfix-20140409
slapos-0.198
slapos-0.197
slapos-0.196
slapos-0.195
slapos-0.194-RC3
slapos-0.194-RC2
slapos-0.194-RC1
slapos-0.193
slapos-0.192
slapos-0.191
slapos-0.190
slapos-0.189
slapos-0.188
slapos-0.187
slapos-0.186
slapos-0.185
slapos-0.184
slapos-0.183
slapos-0.182
slapos-0.181
slapos-0.180
slapos-0.179
slapos-0.178
slapos-0.177.5
slapos-0.177.4
slapos-0.177.3
slapos-0.177.2
slapos-0.177.1
slapos-0.177
slapos-0.176.4
slapos-0.176.3
slapos-0.176.2
slapos-0.176.1
slapos-0.176
slapos-0.175
slapos-0.174
slapos-0.173
slapos-0.172
slapos-0.171
slapos-0.170
slapos-0.169
slapos-0.168.9
slapos-0.168.8
slapos-0.168.7
slapos-0.168.6
slapos-0.168.5
slapos-0.168.4
slapos-0.168.3
slapos-0.168.2
slapos-0.168.1
slapos-0.168
slapos-0.167
slapos-0.166
slapos-0.165
slapos-0.164
slapos-0.163
slapos-0.162
slapos-0.161
slapos-0.160
slapos-0.159
slapos-0.158
slapos-0.157
slapos-0.156
slapos-0.155
slapos-0.154
slapos-0.153
slapos-0.152
slapos-0.151
slapos-0.150
slapos-0.149
slapos-0.148
slapos-0.147
slapos-0.146
slapos-0.145
slapos-0.144
slapos-0.143
slapos-0.142
slapos-0.141
slapos-0.140
slapos-0.139
slapos-0.138
slapos-0.137
slapos-0.136
slapos-0.135.1
slapos-0.135
slapos-0.134
slapos-0.133
slapos-0.132
slapos-0.131
slapos-0.130
slapos-0.129
slapos-0.128
slapos-0.127
slapos-0.126
slapos-0.125
slapos-0.124
slapos-0.123
slapos-0.122
slapos-0.121
slapos-0.120
slapos-0.119
slapos-0.118
slapos-0.117.1
slapos-0.117
slapos-0.116
slapos-0.115
slapos-0.114
slapos-0.113
slapos-0.112
slapos-0.111
slapos-0.110
slapos-0.109
slapos-0.108
slapos-0.107
slapos-0.106
slapos-0.105
slapos-0.104
slapos-0.103
slapos-0.102
slapos-0.101
slapos-0.100
slapos-0.99
slapos-0.98.2
slapos-0.98.1
slapos-0.98
slapos-0.97
slapos-0.96
slapos-0.95
slapos-0.94
slapos-0.93
slapos-0.92
slapos-0.91
slapos-0.90
slapos-0.89
slapos-0.88
slapos-0.87
slapos-0.86
slapos-0.85
slapos-0.84
slapos-0.83
slapos-0.82
erp5-cluster-0.1.1
cygwin-resstack-3
cygwin-resstack-2
cygwin-resstack-1
cygwin-cachetest-4
cygwin-cachetest-3
cygwin-cachetest-2
cygwin-cachetest-1
apache_frontend_prod_test
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
143 additions
and
48 deletions
+143
-48
slapos/recipe/agent/__init__.py
slapos/recipe/agent/__init__.py
+86
-3
slapos/recipe/agent/catdatefile.py
slapos/recipe/agent/catdatefile.py
+14
-0
software/agent/instance-agent.cfg
software/agent/instance-agent.cfg
+0
-23
software/agent/instance.cfg
software/agent/instance.cfg
+20
-13
software/agent/software.cfg
software/agent/software.cfg
+23
-9
No files found.
slapos/recipe/agent/__init__.py
View file @
8cd32a72
...
...
@@ -28,9 +28,92 @@
import
os
import
sys
import
zc.buildout
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
slapos.slap
from
slapos.recipe.librecipe
import
BaseSlapRecipe
from
slapos.recipe.librecipe
import
GenericSlapRecipe
import
json
import
ConfigParser
class
Recipe
(
GenericBase
Recipe
):
class
Recipe
(
BaseSlapRecipe
,
GenericSlap
Recipe
):
def
install
(
self
):
self
.
path_list
=
[]
self
.
crond
=
self
.
installCrond
()
return
[]
slap
=
slapos
.
slap
.
slap
()
computer_id
=
self
.
computer_id
computer_partition_id
=
self
.
computer_partition_id
server_url
=
self
.
server_url
key_file
=
self
.
key_file
cert_file
=
self
.
cert_file
slap
.
initializeConnection
(
server_url
,
key_file
,
cert_file
)
self
.
computer_partition
=
slap
.
registerComputerPartition
(
computer_id
,
computer_partition_id
)
self
.
parameter_dict
=
self
.
computer_partition
.
getInstanceParameterDict
()
configuration_path
=
os
.
path
.
join
(
self
.
work_directory
,
"agent.cfg"
)
configuration
=
ConfigParser
.
SafeConfigParser
()
configuration
.
add_section
(
"agent"
)
configuration
.
set
(
"agent"
,
"portal_url"
,
self
.
parameter_dict
[
"portal_url"
])
configuration
.
set
(
"agent"
,
"master_url"
,
self
.
parameter_dict
[
"master_url"
])
key_filepath
=
os
.
path
.
join
(
self
.
work_directory
,
"key"
)
key_file
=
open
(
key_filepath
,
"w"
)
key_file
.
write
(
self
.
parameter_dict
[
"key"
])
key_file
.
close
()
configuration
.
set
(
"agent"
,
"key_file"
,
key_filepath
)
cert_filepath
=
os
.
path
.
join
(
self
.
work_directory
,
"cert"
)
cert_file
=
open
(
cert_filepath
,
"w"
)
cert_file
.
write
(
self
.
parameter_dict
[
"cert"
])
cert_file
.
close
()
configuration
.
set
(
"agent"
,
"cert_file"
,
cert_filepath
)
configuration
.
set
(
"agent"
,
"maximum_software_installation_duration"
,
self
.
parameter_dict
[
"maximum_software_installation_duration"
])
configuration
.
set
(
"agent"
,
"software_live_duration"
,
self
.
parameter_dict
[
"software_live_duration"
])
configuration
.
set
(
"agent"
,
"computer_list"
,
self
.
parameter_dict
[
"computer_list"
])
configuration
.
set
(
"agent"
,
"software_list"
,
self
.
parameter_dict
[
"software_list"
])
configuration
.
set
(
"agent"
,
"log_directory"
,
self
.
options
[
"log_directory"
])
configuration
.
set
(
"agent"
,
"state_file"
,
self
.
options
[
"state_file"
])
state
=
open
(
self
.
options
[
"state_file"
],
"w"
)
state
.
write
(
''
)
state
.
close
()
configuration
.
add_section
(
"software_uri"
)
software_list
=
json
.
loads
(
self
.
parameter_dict
[
"software_list"
])
for
software
in
software_list
:
configuration
.
set
(
"software_uri"
,
software
,
self
.
parameter_dict
[
software
])
configuration
.
write
(
open
(
configuration_path
,
"w"
))
agent_crond_path
=
os
.
path
.
join
(
self
.
crond
,
"agent"
)
agent_crond
=
open
(
agent_crond_path
,
"w"
)
agent_crond
.
write
(
"*/1 * * * * %s -S %s"
%
\
(
self
.
options
[
"python_binary"
],
"%s --pidfile=%s %s"
%
\
(
self
.
options
[
"agent_binary"
],
self
.
options
[
"pidfile"
],
configuration_path
)))
agent_crond
.
close
()
return
self
.
path_list
+
[
configuration_path
,
key_filepath
,
cert_filepath
,
agent_crond_path
]
def
installCrond
(
self
):
_
,
self
.
ws
=
self
.
egg
.
working_set
()
timestamps
=
self
.
createDataDirectory
(
'cronstamps'
)
cron_output
=
os
.
path
.
join
(
self
.
log_directory
,
'cron-output'
)
self
.
_createDirectory
(
cron_output
)
catcher
=
zc
.
buildout
.
easy_install
.
scripts
([(
'catchcron'
,
__name__
+
'.catdatefile'
,
'catdatefile'
)],
self
.
ws
,
sys
.
executable
,
self
.
bin_directory
,
arguments
=
[
cron_output
])[
0
]
self
.
path_list
.
append
(
catcher
)
cron_d
=
os
.
path
.
join
(
self
.
etc_directory
,
'cron.d'
)
crontabs
=
os
.
path
.
join
(
self
.
etc_directory
,
'crontabs'
)
self
.
_createDirectory
(
cron_d
)
self
.
_createDirectory
(
crontabs
)
wrapper
=
zc
.
buildout
.
easy_install
.
scripts
([(
'crond'
,
'slapos.recipe.librecipe.execute'
,
'execute'
)],
self
.
ws
,
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
self
.
options
[
'dcrond_binary'
].
strip
(),
'-s'
,
cron_d
,
'-c'
,
crontabs
,
'-t'
,
timestamps
,
'-f'
,
'-l'
,
'5'
,
'-M'
,
catcher
]
)[
0
]
self
.
path_list
.
append
(
wrapper
)
return
cron_d
This diff is collapsed.
Click to expand it.
slapos/recipe/agent/catdatefile.py
0 → 100644
View file @
8cd32a72
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
()
This diff is collapsed.
Click to expand it.
software/agent/instance-agent.cfg
deleted
100644 → 0
View file @
6b7b7774
[buildout]
parts =
agent-instance
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[agent-instance]
recipe = slapos.cookbook:agent
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
var = $${buildout:directory}/var
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
[basedirectory]
recipe = slapos.cookbook:mkdirectory
services = $${rootdirectory:etc}/run
run = $${rootdirectory:var}/run
framebuffer = $${rootdirectory:srv}/framebuffer
This diff is collapsed.
Click to expand it.
software/agent/instance.cfg
View file @
8cd32a72
[buildout]
parts =
switch-softwaretype
rootdirectory
instance
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
default = ${template-agent:output}
[slap-connection]
computer-id = $${slap_connection:computer_id}
partition-id = $${slap_connection:partition_id}
server-url = $${slap_connection:server_url}
software-release-url = $${slap_connection:software_release_url}
key-file = $${slap_connection:key_file}
cert-file = $${slap_connection:cert_file}
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
agent_binary = ${buildout:directory}/bin/agent
dcrond_binary = ${dcron:location}/sbin/crond
python_binary = ${python2.7:location}/bin/python
pidfile = $${buildout:directory}/agent.pid
log_directory = $${buildout:directory}/var/log
state_file = $${buildout:directory}/state.cfg
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
run = $${rootdirectory:etc}/run/
var = $${buildout:directory}/var/
log = $${rootdirectory:var}/log/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
This diff is collapsed.
Click to expand it.
software/agent/software.cfg
View file @
8cd32a72
[buildout]
develop =
/
srv/slapgrid/slappart2/srv/runner/project/SlapOS
/
opt/slapdev
/opt/slapos.toolbox
extends =
...
...
@@ -13,21 +13,25 @@ extends =
parts =
template
eggs
instance-recipe-egg
dcron
python2.7
script
[instance-recipe]
egg = slapos.cookbook
module = agent
[instance-recipe-egg]
recipe = zc.recipe.egg
python = python2.7
eggs = ${instance-recipe:egg}
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum = 3cd7b47f979bb880eb9f61f8424e2814
output = ${buildout:directory}/template.cfg
mode = 0644
[template-agent]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-agent.cfg
md5sum = 400945519a33bbdd6a807dbc6b828169
output = ${buildout:directory}/template-agent.cfg
md5sum = 2e1a7a68b18de68b163e98a5f92cc776
mode = 0644
[eggs]
...
...
@@ -41,6 +45,16 @@ eggs =
[lxml-python]
python = python2.7
[script]
recipe = z3c.recipe.scripts
python = python2.7
eggs =
zc.buildout
${lxml-python:egg}
slapos.core
slapos.cookbook
slapos.toolbox
[networkcache]
# signature certificates of the following uploaders.
# Romain Courteaud
...
...
This diff is collapsed.
Click to expand it.
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