Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Klaus Wölfel
slapos.toolbox
Commits
aa358bc8
Commit
aa358bc8
authored
May 26, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import toolbox codebase.
parent
8f3f960c
Changes
97
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
97 changed files
with
3179 additions
and
0 deletions
+3179
-0
CHANGES.txt
slapos/slapos.tool.builder/CHANGES.txt
+2
-0
MANIFEST.in
slapos/slapos.tool.builder/MANIFEST.in
+4
-0
README.txt
slapos/slapos.tool.builder/README.txt
+4
-0
README.txt
slapos/slapos.tool.builder/appliance/README.txt
+1
-0
builds_end_script.sh
slapos/slapos.tool.builder/appliance/builds_end_script.sh
+43
-0
each_boot_script.sh
slapos/slapos.tool.builder/appliance/each_boot_script.sh
+54
-0
setup.py
slapos/slapos.tool.builder/setup.py
+35
-0
__init__.py
slapos/slapos.tool.builder/src/slapos/__init__.py
+7
-0
__init__.py
slapos/slapos.tool.builder/src/slapos/tool/__init__.py
+7
-0
__init__.py
...s/slapos.tool.builder/src/slapos/tool/builder/__init__.py
+331
-0
slapos
...lapos.tool.builder/src/slapos/tool/builder/scripts/slapos
+92
-0
slapos_firstboot
....builder/src/slapos/tool/builder/scripts/slapos_firstboot
+314
-0
hosts.in
...s.tool.builder/src/slapos/tool/builder/templates/hosts.in
+23
-0
ifcfg-br0.in
...ol.builder/src/slapos/tool/builder/templates/ifcfg-br0.in
+15
-0
slapos.cfg.in
...l.builder/src/slapos/tool/builder/templates/slapos.cfg.in
+17
-0
sshd_config.in
....builder/src/slapos/tool/builder/templates/sshd_config.in
+22
-0
CHANGES.txt
slapos/slapos.tool.cloudmgr/CHANGES.txt
+7
-0
README.txt
slapos/slapos.tool.cloudmgr/README.txt
+0
-0
setup.cfg
slapos/slapos.tool.cloudmgr/setup.cfg
+3
-0
setup.py
slapos/slapos.tool.cloudmgr/setup.py
+49
-0
__init__.py
slapos/slapos.tool.cloudmgr/src/slapos/__init__.py
+7
-0
__init__.py
slapos/slapos.tool.cloudmgr/src/slapos/tool/__init__.py
+7
-0
__init__.py
...slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/__init__.py
+7
-0
cloudinterface.py
....tool.cloudmgr/src/slapos/tool/cloudmgr/cloudinterface.py
+38
-0
cloudmgr.py
...slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/cloudmgr.py
+71
-0
destroy.py
.../slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/destroy.py
+15
-0
getprivatekey.py
...s.tool.cloudmgr/src/slapos/tool/cloudmgr/getprivatekey.py
+11
-0
getpubliciplist.py
...tool.cloudmgr/src/slapos/tool/cloudmgr/getpubliciplist.py
+26
-0
lib.py
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/lib.py
+43
-0
list.py
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/list.py
+17
-0
start.py
...os/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/start.py
+18
-0
stop.py
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/stop.py
+36
-0
update.py
...s/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/update.py
+102
-0
CHANGES.txt
slapos/slapos.tool.monitor/CHANGES.txt
+35
-0
README.txt
slapos/slapos.tool.monitor/README.txt
+5
-0
setup.py
slapos/slapos.tool.monitor/setup.py
+41
-0
__init__.py
slapos/slapos.tool.monitor/src/__init__.py
+6
-0
__init__.py
slapos/slapos.tool.monitor/src/slapos/__init__.py
+7
-0
__init__.py
slapos/slapos.tool.monitor/src/slapos/tool/__init__.py
+7
-0
__init__.py
...s/slapos.tool.monitor/src/slapos/tool/monitor/__init__.py
+0
-0
slapmonitor.py
...lapos.tool.monitor/src/slapos/tool/monitor/slapmonitor.py
+250
-0
CHANGES.txt
slapos/slapos.tool.onetimeupload/CHANGES.txt
+14
-0
MANIFEST.in
slapos/slapos.tool.onetimeupload/MANIFEST.in
+3
-0
README.txt
slapos/slapos.tool.onetimeupload/README.txt
+5
-0
setup.cfg
slapos/slapos.tool.onetimeupload/setup.cfg
+3
-0
setup.py
slapos/slapos.tool.onetimeupload/setup.py
+41
-0
__init__.py
slapos/slapos.tool.onetimeupload/src/slapos/__init__.py
+6
-0
__init__.py
slapos/slapos.tool.onetimeupload/src/slapos/tool/__init__.py
+7
-0
__init__.py
...l.onetimeupload/src/slapos/tool/onetimeupload/__init__.py
+125
-0
done.html
...eupload/src/slapos/tool/onetimeupload/templates/done.html
+3
-0
index.html
...upload/src/slapos/tool/onetimeupload/templates/index.html
+10
-0
CHANGES.txt
slapos/slapos.tool.webrunner/CHANGES.txt
+0
-0
MANIFEST.in
slapos/slapos.tool.webrunner/MANIFEST.in
+1
-0
README.txt
slapos/slapos.tool.webrunner/README.txt
+0
-0
setup.py
slapos/slapos.tool.webrunner/setup.py
+37
-0
VERSION.txt
slapos/slapos.tool.webrunner/slapos/VERSION.txt
+1
-0
development.cfg
slapos/slapos.tool.webrunner/slapos/development.cfg
+12
-0
bzip2.py
slapos/slapos.tool.webrunner/slapos/hook/bzip2.py
+19
-0
instance.cfg
slapos/slapos.tool.webrunner/slapos/instance.cfg
+14
-0
gdbm-Makefile.in-nochange.patch
...ol.webrunner/slapos/patch/gdbm-Makefile.in-nochange.patch
+40
-0
bzip2.cfg
slapos/slapos.tool.webrunner/slapos/profile/bzip2.cfg
+20
-0
gdbm.cfg
slapos/slapos.tool.webrunner/slapos/profile/gdbm.cfg
+24
-0
gettext.cfg
slapos/slapos.tool.webrunner/slapos/profile/gettext.cfg
+26
-0
glib.cfg
slapos/slapos.tool.webrunner/slapos/profile/glib.cfg
+18
-0
libxml2.cfg
slapos/slapos.tool.webrunner/slapos/profile/libxml2.cfg
+17
-0
libxslt.cfg
slapos/slapos.tool.webrunner/slapos/profile/libxslt.cfg
+22
-0
lxml-python.cfg
slapos/slapos.tool.webrunner/slapos/profile/lxml-python.cfg
+20
-0
ncurses.cfg
slapos/slapos.tool.webrunner/slapos/profile/ncurses.cfg
+19
-0
openssl.cfg
slapos/slapos.tool.webrunner/slapos/profile/openssl.cfg
+31
-0
pkgconfig.cfg
slapos/slapos.tool.webrunner/slapos/profile/pkgconfig.cfg
+29
-0
popt.cfg
slapos/slapos.tool.webrunner/slapos/profile/popt.cfg
+8
-0
python-2.7.cfg
slapos/slapos.tool.webrunner/slapos/profile/python-2.7.cfg
+55
-0
readline.cfg
slapos/slapos.tool.webrunner/slapos/profile/readline.cfg
+14
-0
sqlite3.cfg
slapos/slapos.tool.webrunner/slapos/profile/sqlite3.cfg
+14
-0
zlib.cfg
slapos/slapos.tool.webrunner/slapos/profile/zlib.cfg
+8
-0
CHANGES.txt
...runner/slapos/recipe/slapos.recipe.slaprunner/CHANGES.txt
+9
-0
MANIFEST.in
...runner/slapos/recipe/slapos.recipe.slaprunner/MANIFEST.in
+2
-0
README.txt
...brunner/slapos/recipe/slapos.recipe.slaprunner/README.txt
+1
-0
setup.py
...webrunner/slapos/recipe/slapos.recipe.slaprunner/setup.py
+33
-0
__init__.py
...os/recipe/slapos.recipe.slaprunner/src/slapos/__init__.py
+6
-0
__init__.py
...pe/slapos.recipe.slaprunner/src/slapos/recipe/__init__.py
+6
-0
__init__.py
...ecipe.slaprunner/src/slapos/recipe/slaprunner/__init__.py
+81
-0
execute.py
...recipe.slaprunner/src/slapos/recipe/slaprunner/execute.py
+6
-0
slapos.cfg.in
...unner/src/slapos/recipe/slaprunner/template/slapos.cfg.in
+25
-0
software.cfg
slapos/slapos.tool.webrunner/slapos/software.cfg
+42
-0
__init__.py
slapos/slapos.tool.webrunner/src/slapos/__init__.py
+6
-0
__init__.py
slapos/slapos.tool.webrunner/src/slapos/tool/__init__.py
+6
-0
__init__.py
.../slapos.tool.webrunner/src/slapos/tool/runner/__init__.py
+117
-0
index.html
...ool.webrunner/src/slapos/tool/runner/templates/index.html
+6
-0
instanceInspect.html
...ner/src/slapos/tool/runner/templates/instanceInspect.html
+13
-0
layout.html
...ol.webrunner/src/slapos/tool/runner/templates/layout.html
+31
-0
runResult.html
...webrunner/src/slapos/tool/runner/templates/runResult.html
+5
-0
updateInstanceProfile.html
...c/slapos/tool/runner/templates/updateInstanceProfile.html
+11
-0
updateSoftwareProfile.html
...c/slapos/tool/runner/templates/updateSoftwareProfile.html
+12
-0
viewLog.html
...l.webrunner/src/slapos/tool/runner/templates/viewLog.html
+7
-0
utils.py
slapos/slapos.tool.webrunner/src/slapos/tool/runner/utils.py
+187
-0
views.py
slapos/slapos.tool.webrunner/src/slapos/tool/runner/views.py
+122
-0
No files found.
slapos/slapos.tool.builder/CHANGES.txt
0 → 100644
View file @
aa358bc8
1.0-dev (unreleased)
--------------------
slapos/slapos.tool.builder/MANIFEST.in
0 → 100644
View file @
aa358bc8
include CHANGES.txt
recursive-include src/slapos/tool/builder/templates *.in
include src/slapos/tool/builder/scripts/slapos
include src/slapos/tool/builder/scripts/slapos_firstboot
slapos/slapos.tool.builder/README.txt
0 → 100644
View file @
aa358bc8
slapbuilder
===========
slapbuilder is a program to install a slapos image.
slapos/slapos.tool.builder/appliance/README.txt
0 → 100644
View file @
aa358bc8
Mirror of files from http://susestudio.com/appliance/
slapos/slapos.tool.builder/appliance/builds_end_script.sh
0 → 100644
View file @
aa358bc8
#!/bin/bash
##############################################################################
#
# 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 advised 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.
#
##############################################################################
#
# This script is executed at the end of appliance creation. Here you can do
# one-time actions to modify your appliance before it is ever used, like
# removing files and directories to make it smaller, creating symlinks,
# generating indexes, etc.
#
# The 'kiwi_type' variable will contain the format of the appliance (oem =
# disk image, vmx = VMware, iso = CD/DVD, xen = Xen).
#
# read in some variables
.
/studio/profile
# Removing eth0 config file which became unecessary with the bridge creation
rm
-f
/etc/sysconfig/network/ifcfg-eth0
slapos/slapos.tool.builder/appliance/each_boot_script.sh
0 → 100644
View file @
aa358bc8
#!/bin/bash
### BEGIN INIT INFO
# Provides: suse_studio_custom
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop:
# Description: Script run whenever the appliance boots
### END INIT INFO
##############################################################################
#
# 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 advised 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.
#
##############################################################################
#
# This script is executed whenever your appliance boots. Here you can add
# commands to be executed before the system enters the first runlevel. This
# could include loading kernel modules, starting daemons that aren't managed
# by init files, asking questions at the console, etc.
#
# The 'kiwi_type' variable will contain the format of the appliance (oem =
# disk image, vmx = VMware, iso = CD/DVD, xen = Xen).
#
#
# read in some variables
.
/studio/profile
if
[
-f
/etc/init.d/suse_studio_firstboot
]
then
/etc/init.d/slapos_firstboot
elif
[
-f
/token_second_boot
]
;
then
/etc/init.d/slapos_secondboot
fi
slapos/slapos.tool.builder/setup.py
0 → 100644
View file @
aa358bc8
# -*- coding: utf-8 -*-
from
setuptools
import
setup
,
find_packages
import
os
name
=
'slapos.tool.builder'
def
read
(
*
rnames
):
return
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
*
rnames
))
.
read
()
long_description
=
(
read
(
'README.txt'
)
+
'
\n
'
+
read
(
'CHANGES.txt'
)
)
setup
(
name
=
name
,
version
=
'1.0-dev-2'
,
description
=
"slapos - partitioning tools for servers"
,
long_description
=
long_description
,
license
=
"GPLv3"
,
keywords
=
"slapos server builder"
,
include_package_data
=
True
,
packages
=
find_packages
(
'src'
),
package_dir
=
{
''
:
'src'
},
namespace_packages
=
[
'slapos'
],
# slapgos use this to create a clean ouput
install_requires
=
[
'setuptools'
,
# namespace
],
entry_points
=
"""
[console_scripts]
slapbuilder =
%
s:main
"""
%
name
,
)
slapos/slapos.tool.builder/src/slapos/__init__.py
0 → 100644
View file @
aa358bc8
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
)
.
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/slapos.tool.builder/src/slapos/tool/__init__.py
0 → 100644
View file @
aa358bc8
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
)
.
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/slapos.tool.builder/src/slapos/tool/builder/__init__.py
0 → 100644
View file @
aa358bc8
This diff is collapsed.
Click to expand it.
slapos/slapos.tool.builder/src/slapos/tool/builder/scripts/slapos
0 → 100755
View file @
aa358bc8
#!/bin/sh
### BEGIN INIT INFO
# Provides: slapos
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 3 5
# Default-Stop:
# Description: Run SlapOS
### END INIT INFO
##############################################################################
#
# 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 advised 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.
#
##############################################################################
case
"
$1
"
in
start
)
# clean the system
for
service
in
rpcbind network-remotefs postfix
;
do
chkconfig
--del
$service
/etc/init.d/
$service
stop
done
# set random root password
pwgen
-sync
512 1 | passwd
--stdin
root
SLAP_INSTALL_LOG
=
/opt/slapos/slapos-install.log
if
[
!
-f
/opt/slapos/bin/slapformat
]
;
then
while
[
!
-f
/opt/slapos/bin/slapformat
]
;
do
echo
-n
"Installing SlapOS, log availble at
${
SLAP_INSTALL_LOG
}
..."
# software not detected, force forever installation
mkdir
-p
/opt/slapos
(
python
-S
-c
\
'import urllib2;print urllib2.urlopen("http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py").read()'
\
| python
-S
-
-c
/etc/slapos/software.cfg buildout:directory
=
/opt/slapos
\
>>
${
SLAP_INSTALL_LOG
}
2>&1
&&
/opt/slapos/bin/buildout
-c
\
/etc/slapos/software.cfg buildout:directory
=
/opt/slapos
>>
\
${
SLAP_INSTALL_LOG
}
2>&1
)
&&
(
echo
"done."
)
||
(
echo
\
"failed, retrying, the last error was:."
;
tail
-n
20
${
SLAP_INSTALL_LOG
}
;
rm
-f
/opt/slapos/bin/slapformat
)
done
fi
# software detected, ready to run
# Set up cron
echo
"""# BEWARE: This file will be automatically regenerated on each boot
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root
0 0 * * * root /opt/slapos/bin/slapformat --verbose --log_file=/opt/slapos/slapformat.log /etc/slapos/slapos.cfg >> /opt/slapos/slapformat.log 2>&1
*/5 * * * * root /opt/slapos/bin/slapgrid-cp --verbose --logfile=/opt/slapos/slapgrid-cp.log --pidfile=/opt/slapos/slapgrid-cp.pid /etc/slapos/slapos.cfg >> /opt/slapos/slapgrid-cp.log 2>&1
*/5 * * * * root /opt/slapos/bin/slapgrid-sr --verbose --logfile=/opt/slapos/slapgrid-sr.log --pidfile=/opt/slapos/slapgrid-sr.pid /etc/slapos/slapos.cfg >> /opt/slapos/slapgrid-sr.log 2>&1
0 0 * * * root /opt/slapos/bin/slapgrid-ur --verbose --logfile=/opt/slapos/slapgrid-ur.log --pidfile=/opt/slapos/slapgrid-ur.pid /etc/slapos/slapos.cfg >> /opt/slapos/slapgrid-ur.log 2>&1
"""
>
/etc/cron.d/slapos
# Execute slapformat
echo
-n
"Running slapformat..."
/opt/slapos/bin/slapformat
--verbose
--console
/etc/slapos/slapos.cfg
echo
"done."
# Set kvm up
modprobe kvm_intel
chmod
666 /dev/kvm
# Enable noop scheduler for disk which have SLAPOS labeled partition
disk
=
`
blkid
-L
SLAPOS |
sed
-r
-e
's/(\/dev\/|[0-9]*$)//g'
`
echo
noop
>
/sys/block/
$disk
/queue/scheduler
;;
esac
slapos/slapos.tool.builder/src/slapos/tool/builder/scripts/slapos_firstboot
0 → 100755
View file @
aa358bc8
This diff is collapsed.
Click to expand it.
slapos/slapos.tool.builder/src/slapos/tool/builder/templates/hosts.in
0 → 100644
View file @
aa358bc8
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
#
127.0.0.1 %(computer_id)s localhost
# special IPv6 addresses
::1 %(computer_id)s localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
slapos/slapos.tool.builder/src/slapos/tool/builder/templates/ifcfg-br0.in
0 → 100644
View file @
aa358bc8
BOOTPROTO='dhcp'
BRIDGE='yes'
BRIDGE_FORWARDDELAY='0'
BRIDGE_PORTS='eth0'
BRIDGE_STP='off'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR=''
MTU=''
NAME=''
NETMASK=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'
slapos/slapos.tool.builder/src/slapos/tool/builder/templates/slapos.cfg.in
0 → 100644
View file @
aa358bc8
[slapos]
software_root = /opt/slapgrid
instance_root = /srv/slapgrid
master_url = %(master_url)s
computer_id = %(computer_id)s
key_file = %(key_file)s
cert_file = %(cert_file)s
certificate_repository_path = %(certificate_repository_path)s
[slapformat]
computer_xml = /opt/slapos/slapos.xml
partition_amount = 200
bridge_name = br0
partition_base_name = slappart
user_base_name = slapuser
tap_base_name = slaptap
ipv4_local_network = 10.0.0.0/16
slapos/slapos.tool.builder/src/slapos/tool/builder/templates/sshd_config.in
0 → 100644
View file @
aa358bc8
PermitRootLogin yes
AllowUsers root
AddressFamily inet6
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
PasswordAuthentication no
X11Forwarding yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL
Subsystem sftp /usr/lib64/ssh/sftp-server
UsePAM yes
slapos/slapos.tool.cloudmgr/CHANGES.txt
0 → 100644
View file @
aa358bc8
0.0.2 (unreleased)
------------------
0.0.1 (2010-10-22)
------------------
- working version
[Lukasz Nowak]
slapos/slapos.tool.cloudmgr/README.txt
0 → 100644
View file @
aa358bc8
slapos/slapos.tool.cloudmgr/setup.cfg
0 → 100644
View file @
aa358bc8
[egg_info]
tag_build = .dev
tag_svn_revision = 1
slapos/slapos.tool.cloudmgr/setup.py
0 → 100644
View file @
aa358bc8
from
setuptools
import
setup
,
find_packages
import
os
name
=
"slapos.tool.cloudmgr"
version
=
'0.0.2'
def
read
(
*
rnames
):
return
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
*
rnames
))
.
read
()
long_description
=
(
read
(
'README.txt'
)
+
'
\n
'
+
read
(
'CHANGES.txt'
)
)
setup
(
name
=
name
,
version
=
version
,
author
=
'Lukasz Nowak'
,
author_email
=
'luke@nexedi.com'
,
description
=
"cloudmgr -- tools to manage clouds by using libcloud"
,
long_description
=
long_description
,
license
=
"GPL"
,
keywords
=
"cloud libcloud manager"
,
classifiers
=
[
],
packages
=
find_packages
(
'src'
),
include_package_data
=
True
,
package_dir
=
{
''
:
'src'
},
namespace_packages
=
[
'slapos'
,
'slapos.tool'
],
install_requires
=
[
'setuptools'
,
# namespaces
'paramiko'
,
'apache_libcloud>=0.4.0'
,
#False name, 0.4.0 is not yet released on pypi
# and erpypi does not support names with "-"
],
url
=
'https://svn.erp5.org/repos/vifib/trunk/utils/slapos.tool.cloudmgr/'
,
zip_safe
=
True
,
entry_points
=
"""
[console_scripts]
cloudmgr=slapos.tool.cloudmgr.cloudmgr:main
cloudlist=slapos.tool.cloudmgr.list:main
clouddestroy=slapos.tool.cloudmgr.destroy:main
cloudstart=slapos.tool.cloudmgr.start:main
cloudstop=slapos.tool.cloudmgr.stop:main
cloudgetprivatekey=slapos.tool.cloudmgr.getprivatekey:main
cloudgetpubliciplist=slapos.tool.cloudmgr.getpubliciplist:main
"""
%
dict
(
name
=
name
),
)
slapos/slapos.tool.cloudmgr/src/slapos/__init__.py
0 → 100644
View file @
aa358bc8
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
)
.
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/slapos.tool.cloudmgr/src/slapos/tool/__init__.py
0 → 100644
View file @
aa358bc8
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
)
.
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/__init__.py
0 → 100644
View file @
aa358bc8
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
)
.
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/cloudinterface.py
0 → 100644
View file @
aa358bc8
from
update
import
update
from
destroy
import
destroy
from
start
import
start
from
stop
import
stop
from
list
import
uuidlist
from
getpubliciplist
import
getpubliciplist
class
NodeInterface
:
def
__init__
(
self
,
key
,
secret
,
service
,
location
,
node_uuid
=
None
,
ssh_key
=
None
):
self
.
key
=
key
self
.
location
=
location
self
.
node_uuid
=
node_uuid
self
.
ssh_key
=
ssh_key
self
.
secret
=
secret
self
.
service
=
service
def
update
(
self
,
image
,
size
,
security_group
):
result
=
update
(
self
.
key
,
self
.
secret
,
self
.
service
,
self
.
location
,
self
.
node_uuid
,
self
.
ssh_key
,
image
,
size
,
security_group
)
self
.
node_uuid
=
result
[
'node_uuid'
]
self
.
ssh_key
=
result
[
'ssh_key'
]
return
result
def
stop
(
self
):
stop
(
self
.
key
,
self
.
secret
,
self
.
service
,
self
.
node_uuid
,
self
.
ssh_key
)
def
start
(
self
):
start
(
self
.
key
,
self
.
secret
,
self
.
service
,
self
.
node_uuid
)
def
destroy
(
self
):
destroy
(
self
.
key
,
self
.
secret
,
self
.
service
,
self
.
node_uuid
)
def
getPublicIpList
(
self
):
return
getpubliciplist
(
self
.
key
,
self
.
secret
,
self
.
service
,
self
.
node_uuid
)
def
getNodeUuidList
(
self
):
return
uuidlist
(
self
.
key
,
self
.
secret
,
self
.
service
)
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/cloudmgr.py
0 → 100644
View file @
aa358bc8
import
sys
import
time
from
cloudinterface
import
NodeInterface
class
CloudManager
:
def
__init__
(
self
,
configuration_file
):
self
.
configuration_file
=
configuration_file
self
.
initialiseConfiguration
()
def
initialiseConfiguration
(
self
):
self
.
configuration_dict
=
{}
try
:
external_eval
=
file
(
self
.
configuration_file
)
.
read
()
except
IOError
:
pass
else
:
try
:
self
.
configuration_dict
=
eval
(
external_eval
)
except
:
pass
if
type
(
self
.
configuration_dict
)
!=
type
({}):
self
.
configuration_dict
=
{}
for
k
in
'key'
,
'secret'
:
if
k
not
in
self
.
configuration_dict
:
self
.
configuration_dict
[
k
]
=
''
elif
type
(
self
.
configuration_dict
[
k
])
!=
type
(
''
):
self
.
configuration_dict
[
k
]
=
''
if
'node_list'
not
in
self
.
configuration_dict
:
self
.
configuration_dict
[
'node_list'
]
=
[]
if
type
(
self
.
configuration_dict
[
'node_list'
])
!=
type
([]):
self
.
configuration_dict
[
'node_list'
]
=
[]
def
run
(
self
):
print
'Run begin...'
started
=
stopped
=
destroyed
=
unsupported
=
0
self
.
key
=
self
.
configuration_dict
[
'key'
]
self
.
secret
=
self
.
configuration_dict
[
'secret'
]
for
node
in
self
.
configuration_dict
[
'node_list'
]:
node_object
=
NodeInterface
(
self
.
key
,
self
.
secret
,
node
[
'service'
],
node
[
'location'
],
node
[
'node_uuid'
],
node
[
'ssh_key'
])
if
node
[
'requested_state'
]
==
'started'
:
print
'Starting
%
r'
%
node
[
'node_uuid'
]
if
node_object
.
start
():
started
+=
1
else
:
unsupported
+=
1
elif
node
[
'requested_state'
]
==
'stopped'
:
print
'Stopping
%
r'
%
node
[
'node_uuid'
]
if
node_object
.
stop
():
stopped
+=
1
else
:
unsupported
+=
1
elif
node
[
'requested_state'
]
==
'destroyed'
:
print
'Destroying
%
r'
%
node
[
'node_uuid'
]
if
node_object
.
destroy
():
destroyed
+=
1
else
:
unsupported
+=
1
else
:
print
'Unsupported state
%
r for node
%
r'
%
(
node
[
'requested_state'
],
node
[
'node_uuid'
])
unsupported
+=
1
print
'Run finished'
,
dict
(
started
=
started
,
stopped
=
stopped
,
destroyed
=
destroyed
,
unsupported
=
unsupported
)
def
main
():
while
True
:
CloudManager
(
sys
.
argv
[
1
])
.
run
()
time
.
sleep
(
5
)
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/destroy.py
0 → 100644
View file @
aa358bc8
from
slapos.tool.cloudmgr.lib
import
getDriverInstance
,
getNode
from
libcloud.types
import
NodeState
import
sys
def
destroy
(
key
,
secret
,
service
,
node_uuid
):
driver
=
getDriverInstance
(
service
,
key
,
secret
)
node
=
getNode
(
driver
,
node_uuid
)
if
node
is
None
:
return
False
if
node
.
state
in
[
NodeState
.
RUNNING
,
NodeState
.
REBOOTING
,
NodeState
.
PENDING
]:
return
node
.
destroy
()
else
:
return
False
def
main
():
print
destroy
(
sys
.
argv
[
1
],
sys
.
argv
[
2
],
sys
.
argv
[
3
],
sys
.
argv
[
4
])
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/getprivatekey.py
0 → 100644
View file @
aa358bc8
import
sys
def
getprivatekey
(
key
,
secret
,
service
,
node_uuid
):
"""Fetches private key of node"""
raise
NotImplementedError
(
'Cedric implement'
)
return
dict
(
ssh_key
=
ssh_key
,
)
def
main
():
getprivatekey
(
sys
.
argv
[
1
],
sys
.
argv
[
2
],
sys
.
argv
[
3
],
sys
.
argv
[
4
])
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/getpubliciplist.py
0 → 100644
View file @
aa358bc8
from
slapos.tool.cloudmgr.lib
import
getDriverInstance
,
getNode
from
libcloud.types
import
NodeState
import
time
import
sys
def
getpubliciplist
(
key
,
secret
,
service
,
node_uuid
):
"""Gets public ip(s), can wait for the first IP to appear"""
public_ip_list
=
[]
for
i
in
range
(
100
):
driver
=
getDriverInstance
(
service
,
key
,
secret
)
node
=
getNode
(
driver
,
node_uuid
)
if
node
.
state
not
in
[
NodeState
.
RUNNING
,
NodeState
.
REBOOTING
,
NodeState
.
PENDING
]:
break
if
node
.
public_ip
[
0
]:
public_ip_list
=
node
.
public_ip
break
else
:
time
.
sleep
(
5
)
return
dict
(
public_ip_list
=
public_ip_list
)
def
main
():
print
getpubliciplist
(
sys
.
argv
[
1
],
sys
.
argv
[
2
],
sys
.
argv
[
3
],
sys
.
argv
[
4
])
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/lib.py
0 → 100644
View file @
aa358bc8
from
libcloud.types
import
Provider
from
libcloud.providers
import
get_driver
import
paramiko
import
StringIO
driver_list
=
{
'DUMMY'
:
get_driver
(
Provider
.
DUMMY
),
'EC2_US_EAST'
:
get_driver
(
Provider
.
EC2_US_EAST
),
'EC2_US_WEST'
:
get_driver
(
Provider
.
EC2_US_WEST
),
'EC2_EU_WEST'
:
get_driver
(
Provider
.
EC2_EU_WEST
),
'RACKSPACE'
:
get_driver
(
Provider
.
RACKSPACE
),
'SLICEHOST'
:
get_driver
(
Provider
.
SLICEHOST
),
'GOGRID'
:
get_driver
(
Provider
.
GOGRID
),
'VPSNET'
:
get_driver
(
Provider
.
VPSNET
),
'LINODE'
:
get_driver
(
Provider
.
LINODE
),
'VCLOUD'
:
get_driver
(
Provider
.
VCLOUD
),
'RIMUHOSTING'
:
get_driver
(
Provider
.
RIMUHOSTING
),
'ECP'
:
get_driver
(
Provider
.
ECP
),
'IBM'
:
get_driver
(
Provider
.
IBM
),
'OPENNEBULA'
:
get_driver
(
Provider
.
OPENNEBULA
),
'DREAMHOST'
:
get_driver
(
Provider
.
DREAMHOST
),
}
def
getDriverInstance
(
driverName
,
key
,
secret
=
None
,
secure
=
True
,
host
=
None
,
port
=
None
):
return
driver_list
.
get
(
driverName
)(
key
,
secret
,
secure
,
host
,
port
)
def
getSSHConnection
(
driver
,
hostname
,
private_key
):
client
=
paramiko
.
SSHClient
()
client
.
load_system_host_keys
()
client
.
set_missing_host_key_policy
(
paramiko
.
WarningPolicy
())
#TODO if exception : try DSSKey
pkey
=
paramiko
.
RSAKey
.
from_private_key
(
StringIO
.
StringIO
(
private_key
))
client
.
connect
(
hostname
=
hostname
,
username
=
'root'
,
pkey
=
pkey
,
look_for_keys
=
False
)
return
client
def
getNode
(
driver
,
node_uuid
):
node_list
=
[
node
for
node
in
driver
.
list_nodes
()
if
node_uuid
in
node
.
uuid
]
if
len
(
node_list
)
==
0
:
return
None
if
len
(
node_list
)
!=
1
:
raise
IndexError
(
'Several nodes with the uuid
%
r exist.'
%
node_uuid
)
return
node_list
[
0
]
slapos/slapos.tool.cloudmgr/src/slapos/tool/cloudmgr/list.py
0 → 100644
View file @
aa358bc8
# Original work by Cedric de Saint Martin, adapted by Lukasz Nowak
import
sys
from
slapos.tool.cloudmgr.lib
import
getDriverInstance
def
nodelist
(
key
,
secret
,
service
):
driver
=
getDriverInstance
(
service
,
key
,
secret
)
node_list
=
driver
.
list_nodes
()
return
node_list
def
uuidlist
(
key
,
secret
,
service
):
return
[
q
.
uuid
for
q
in
nodelist
(
key
,
secret
,
service
)]
def
main
():