slapconsole is included with SlapOS client (and SlapOS Node).
It is a python console with the necessary modules already imported.
It will allow you to request and manage your instances, as if you were on slapos.org, but from the console.
$ slapos console ~/.slapos/slapos-client.cfg
>>> instance_a = request(wordpress, "Wordpress A from console")
>>> instance_a.getState()
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.6/site-packages/.../slapos/console.py", line 108, in
slap.registerOpenOrder().request(software_release, reference)
File "/Library/Python/2.6/site-packages/slapos/slap/slap.py", line 162, in request
self._connection_helper.POST('/requestComputerPartition', request_dict)
File "/Library/Python/2.6/site-packages/slapos/slap/slap.py", line 469, in POST
raise ResourceNotReady("%s - %s" % (path, parameter_dict))
ResourceNotReady: /requestComputerPartition
# Wait for a few minutes and retry until it works.
# Calling "request" with an existing instance name just fetch/update parameters from existing.
>>> instance_a = request(wordpress, "Wordpress A from console")
>>> instance_a.getState()
Started
>>> instance_a.getConnectionParameter('url')
[URL appears here]
$ slapos console ~/.slapos/slapos-client.cfg
>>> instance_b = request(wordpress, "Wordpress B from console",
filter_kw={ "computer_guid": "COMP-12345" })
>>> instance_b.getState()
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.6/site-packages/.../slapos/console.py", line 108, in
slap.registerOpenOrder().request(software_release, reference)
File "/Library/Python/2.6/site-packages/slapos/slap/slap.py", line 162, in request
self._connection_helper.POST('/requestComputerPartition', request_dict)
File "/Library/Python/2.6/site-packages/slapos/slap/slap.py", line 469, in POST
raise ResourceNotReady("%s - %s" % (path, parameter_dict))
ResourceNotReady: /requestComputerPartition
# Wait for a few minutes and retry until it works:
>>> instance_b = request(wordpress, "Wordpress B from console",
filter_kw={ "computer_guid": "COMP-12345" })
>>> instance_b.getState()
Started
>>> instance_b.getConnectionParameter('url')
[URL appears here]
Here we are going to request a new instance on a specific computer.
$ slaposconsole ~/.slapos/slapos-client.cfg
# We will modify our first instance:
>>> instance_a = request(wordpress, "Wordpress A from console",
partition_parameter_kw={"domain":"mydomain.com"})
# Wait for a few minutes for the change to be effective:
>>> instance_a = request(wordpress, "Wordpress A from console",
partition_parameter_kw={"domain":"mydomain.com"})
>>> instance_a.getConnectionParameter('url')
[New URL appears here]
Here we are going to modify an existing instance to add some parameters. Of course, you can directly define parameters in new instances.
For more information, please contact Jean-Paul, CEO of Nexedi (+33 629 02 44 25).