parser = OptionParser(
        prog="transform_template",
        version="0",
        usage="%prog [options]")

    parser.add_option(
        "-t", "--target_file", type="string", default="/tmp/template.txt",
        help="Path to place the template file in (default: %default)")

    parser.add_option(
        "-s", "--source_file", type="string", default="./test-cluster.json",
        help="Path to json formated source file (default: %default)")

    (options, arguments)  = parser.parse_args()

    if len(arguments) != 0:
        parser.print_help()
        sys.exit(1)

    return options

if __name__ == "__main__":
    # get the commandline arguments
    options = parse_arguments()

    # Create template
    cfn_template = CloudFormationTemplate()
    cfn_template.load_json_source(options.source_file)
    cfn_template.save_template_file(options.target_file)
    # pprint(cfn_template.source)
# Testscript for template generation and deploying

from cloud_provider.amazon import Amazon
from template.template import CloudFormationTemplate
from pprint import pprint

if __name__ == "__main__":
    # Amazon Settings
    region = "eu-west-1"
    stack_name = 'TestStack'

    # Template settings
    template_file = '/tmp/template.txt'
    template_json_source_file = 'test-cluster.json'

    # Create template
    cfn_template = CloudFormationTemplate()
    cfn_template.load_json_source(template_json_source_file)
    cfn_template.save_template_file(template_file)
    # pprint(cfn_template.source)

    # Connect to Amazon CloudFormation
    aws = Amazon(region)

    # Deploy CloudFormation Template
    aws.deploy_stack(stack_name, template_file=template_file)

    # Delete Stack if error occured
    # aws.delete_stack(stack_name)