Added code to build and copy relevant files to cloud system and setup


Now resource_spawner prepare temporary directory by populating required files
including ssh keys, puppet code, fabric and userdata script.

Fab functions are added to copy the temporary directory to lb node (jump host)
of the cloud system being built, run userdata to do basic setup, install puppet code,
setup fab by copying fabfile to ubuntu home directory. and then to run fab function
"setup" to setup the entire cloud system.

Here are the files to be copied from build system to cloud
1. ssh keys for ubuntu user - these keys are generated by resource_spawner script
2. jiocloud_puppet_builder directory - this contains base puppet code, fabfile and userdata script
3. Puppet modules - puppet modules are built by resource_spawner script using puppet-librarian-simple.

Here are the changes in resource_spawner script:

Added new function setupTmpDir:

Earlier mktemp was called directly in the main code, moved that code to new function and added code to copy jiocloud_puppet_builder to temporary location.

Changed setupPuppet function:

Now setup pupet modules in temporary directory - before setupPuppet runs,
jiocloud_puppet_builder is copied to temp directory and then run this fucntion to setup puppet modules.

Also added sudo on apt-get install and gem install to make this script work for non-root user also.
Now script will only trying apt-get install if librarian-puppet-simple is not installed

Now fab code will copy the temporary directory prepared by resource spawner to lb

Modified putFiles()

Added code to make directory if not exists before copy. Also added one argument t

Modified initiateSetup()

Takes directory path as arugment and make a tar of directory.
Copy the tar file to lb server of cloud system
Untar the file on lb
copy puppet code to /var/puppet
copy fabfile to ~ubuntu/
Run userdata.sh to setup basic things and install fabric and puppet
Run fab (function setup) to setup the entire cloud system.

Modified setup()

Now copy puppet code and user data to all systems
run userdata for basic setup and puppet installation
setup the cloud systems by running puppet.

Now accept three parameters:
dir: directory path to copy to all cloud systems
verify: whtether to run checkAll function to verify the cloud systems or not
verbose: yes or no

Removed unnecessary functions:

getHostname: this was to do a reverse dns lookup and prepare a dictionary of host
callHosts: this was to call getHostname
I would much rather this directory created in ./tmp/ as opposed to /tmp/. This is b/c from jenkins it should be associated with the build directory and not be stored as global state