solar/examples/compiled-resources
Jedrzej Nowak 1807219376 Removed old db implementation 2015-11-17 13:01:21 +01:00
..
README.md Compiled resources README and example simplification 2015-09-07 15:48:32 +02:00
example-compiled-resources.py Removed old db implementation 2015-11-17 13:01:21 +01:00

README.md

Example script that uses the "compiled resources" functionality

To run this code, first compile the resources with

solar resource compile_all

Please note that you don't have to anymore write

node1 = resource.create('node1', 'resources/ro_node/', {'ip': '10.0.0.3', 'ssh_key': '/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key', 'ssh_user': 'vagrant'})

but instead you can do:

import resources_compiled

node1 = resources_compiled.RoNodeResource('node1', None, {})
node1.ip = '10.0.0.3'
node1.ssh_key = '/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key'
node1.ssh_user = 'vagrant'

Resources aren't anymore a collection of dicts with inputs that are hard to trace, but they are full Python classes for which you can use your IDE's autocompletion, etc. functionality.