diff options
-rw-r--r-- | docs/how-to-use/InstallSnaps.rst | 6 | ||||
-rw-r--r-- | docs/how-to-use/LibraryUsage.rst | 28 | ||||
-rw-r--r-- | docs/how-to-use/Testing.rst | 4 | ||||
-rw-r--r-- | docs/how-to-use/VirtEnvDeploy.rst | 6 | ||||
-rw-r--r-- | examples/launch.py | 17 |
5 files changed, 32 insertions, 29 deletions
diff --git a/docs/how-to-use/InstallSnaps.rst b/docs/how-to-use/InstallSnaps.rst index 9412579..cce06a0 100644 --- a/docs/how-to-use/InstallSnaps.rst +++ b/docs/how-to-use/InstallSnaps.rst @@ -17,13 +17,13 @@ CentOS 7 :: - # yum install -7 git gcc python-pip python-devel openssl-devel + sudo yum install -7 git gcc python-pip python-devel openssl-devel Ubuntu ------ :: - # apt-get install git python2.7-dev libssl-dev + sudo apt-get install git python2.7-dev libssl-dev Optional: Setup a Python virtual environment -------------------------------------------- @@ -39,6 +39,6 @@ The "pip" command below needs to be executed as root, if you are not using a vir :: - # pip install -e <path to repo>/snaps/ + sudo pip install -e <path to repo>/snaps/ The install should now be complete and you can start using the SNAPS-OO libraries. diff --git a/docs/how-to-use/LibraryUsage.rst b/docs/how-to-use/LibraryUsage.rst index 6c84afd..36d4b9c 100644 --- a/docs/how-to-use/LibraryUsage.rst +++ b/docs/how-to-use/LibraryUsage.rst @@ -49,8 +49,8 @@ Create OS Credentials Object .. code:: python from snaps.openstack.os_credentials import OSCreds - os_creds=OSCreds(username='admin', password`='admin' - auth_url='http://localhost:5000/v3, project_name='admin', + os_creds=OSCreds(username='admin', password='admin', + auth_url='http://localhost:5000/v3', project_name='admin', identity_api_version=3) SNAPS Object Creators @@ -84,7 +84,7 @@ Create User .. code:: python from snaps.openstack.create_user import UserSettings, OpenStackUser - user_settings = UserSettings(name='username', password='password) + user_settings = UserSettings(name='username', password='password') user_creator = OpenStackUser(os_creds, user_settings) user_creator.create() @@ -109,10 +109,11 @@ Create Project - enables - flag to determine whether or not the project should be enabled (default=True) + .. code:: python from snaps.openstack.create_project import ProjectSettings, OpenStackProject - project_settings = ProjectSettings(name='username', password='password) + project_settings = ProjectSettings(name='username', password='password') project_creator = OpenStackProject(os_creds, project_settings) project_creator.create() @@ -311,8 +312,7 @@ Create Security Group .. code:: python - from snaps.openstack.create_security_group import SecurityGroupSettings, SecurityGroupRuleSettings, Direction, - OpenStackSecurityGroup + from snaps.openstack.create_security_group import SecurityGroupSettings, SecurityGroupRuleSettings, Direction, OpenStackSecurityGroup rule_settings = SubnetSettings(name='subnet-name', cidr='10.0.0.0/24') network_settings = NetworkSettings(name='network-name', subnet_settings=[subnet_settings]) @@ -437,9 +437,9 @@ Create VM Instance from snaps.openstack.create_network import PortSettings port_settings = PortSettings(name='port-name', network_name=network_settings.name) - floating_ip_settings = FloatingIpSettings(name='fip1', port_name=port_settings.name, router_name=router_settings.name - instance_settings = VmInstanceSettings(name='vm-name', flavor='flavor_settings.name, port_settings=[port_settings], - floating_ip_settings=[floating_ip_settings] + floating_ip_settings = FloatingIpSettings(name='fip1', port_name=port_settings.name, router_name=router_settings.name) + instance_settings = VmInstanceSettings(name='vm-name', flavor='flavor_settings.name', port_settings=[port_settings], + floating_ip_settings=[floating_ip_settings]) instance_creator = OpenStackVmInstance(os_creds, instance_settings, image_settings, kepair_settings) instance_creator.create() @@ -480,14 +480,12 @@ Apply Ansible Playbook Utility from snaps.provisioning import ansible_utils - ansible_utils.apply_playbook(playbook_path='/tmp/playbook.yml', - hosts_inv=[instance_creator.get_port_ip(instance_settings.port_settings[0].name, - host_user=instance_creator.get_image_user(), - ssh_priv_key_file_path=instance_creator.keypair_settings.private_filepath) - + ansible_utils.apply_playbook(playbook_path='provisioning/tests/playbooks/simple_playbook.yml', + hosts_inv=[ip], host_user=user, ssh_priv_key_file_path=priv_key, + proxy_setting=self.os_creds.proxy_settings) OpenStack Utilities -======================================= +=================== For those who do like working procedurally, SNAPS-OO also leverages utilitarian functions for nearly every query or request made to diff --git a/docs/how-to-use/Testing.rst b/docs/how-to-use/Testing.rst index 7627927..66b8e5d 100644 --- a/docs/how-to-use/Testing.rst +++ b/docs/how-to-use/Testing.rst @@ -6,8 +6,8 @@ Execute the tests :: -cd <path to repo> -python snaps/unit_test_suite.py -e <path to RC file> -n <external network name> + cd <path to repo> + python snaps/unit_test_suite.py -e <path to RC file> -n <external network name> | \* All Supported Arguments | \* -e [required - The path to the OpenStack RC file] diff --git a/docs/how-to-use/VirtEnvDeploy.rst b/docs/how-to-use/VirtEnvDeploy.rst index 58a33d5..f8a1e3c 100644 --- a/docs/how-to-use/VirtEnvDeploy.rst +++ b/docs/how-to-use/VirtEnvDeploy.rst @@ -23,19 +23,19 @@ Use launcher.py to deploy and clean up example environments. These examples are :: - cd <snaps repo>/examples/ + cd <snaps repo>/examples/ #. Deploy the launcher. :: - $ python launcher.py -e ./complex-network/deploy-complex-network.yaml -d + python launch.py -e ./complex-network/deploy-complex-network.yaml -d #. Clean the deployment. :: - $ python launcher.py -e ./complex-network/deploy-complex-network.yaml -c + python launch.py -e ./complex-network/deploy-complex-network.yaml -c #. Customize the deployment by changing the yaml file. diff --git a/examples/launch.py b/examples/launch.py index 5f2e999..6ddfe3b 100644 --- a/examples/launch.py +++ b/examples/launch.py @@ -246,7 +246,7 @@ def __create_instances(os_conn_config, instances_config, image_dict, keypairs_di raise e logger.info('Created configured instances') - + # TODO Should there be an error if there isn't an instances config return vm_dict @@ -525,7 +525,7 @@ def main(arguments): logger.info('Starting to Deploy') config = file_utils.read_yaml(arguments.environment) - logger.info('Read configuration file - ' + arguments.environment) + logger.debug('Read configuration file - ' + arguments.environment) if config: os_config = config.get('openstack') @@ -542,7 +542,7 @@ def main(arguments): # Create flavors flavor_dict = __create_flavors(os_conn_config, os_config.get('flavors'), - arguments.clean is not ARG_NOT_SET) + arguments.clean is not ARG_NOT_SET) # Create images image_dict = __create_images(os_conn_config, os_config.get('images'), @@ -569,7 +569,6 @@ def main(arguments): __cleanup(vm_dict, keypairs_dict, router_dict, network_dict, image_dict, flavor_dict, True) raise e - # Must enter either block if arguments.clean is not ARG_NOT_SET: # Cleanup Environment @@ -600,9 +599,15 @@ def __cleanup(vm_dict, keypairs_dict, router_dict, network_dict, image_dict, fla for key, kp_inst in keypairs_dict.iteritems(): kp_inst.clean() for key, router_inst in router_dict.iteritems(): - router_inst.clean() + try: + router_inst.clean() + except Exception: + logger.warning("Router not found continuing to next component") for key, net_inst in network_dict.iteritems(): - net_inst.clean() + try: + net_inst.clean() + except Exception: + logger.warning("Network not found continuing to next component") if clean_image: for key, image_inst in image_dict.iteritems(): image_inst.clean() |