# manually initializing the pycloudsigma module

How to manually initialize the pycloudsigma module - possibly from libcloud data.

pycloudsigma expects its configuration in ~/.cloudsigma.conf.

However if you are - as an example - working with both libcloud and its Cloudsigma driver then you allready had to configure those things for the libcloud driver and optimaly would not want to do the initialization twice.

Here is a solution to initialize the pycloudsigma module from the libcloud configuration. It should be easily adaptable to initializing it with plain strings withouth needing to fetch the configuration items from libcloud.

def init_cloudsigma_from_libcloud_driver(libcloud_driver):
# let the cloudsigma module load an empty configuration file
os.putenv('CLOUDSIGMA_CONFIG','/dev/null')

# now import (and initialize) the cloudsigma module
import cloudsigma

# Set all pycloudsigma config parameters manually.
#
# These are the parameters that are usually configured
# from ~/.cloudsigma.conf. See