]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
remove old experimental code
authorAngus Salkeld <asalkeld@redhat.com>
Tue, 17 Apr 2012 02:09:30 +0000 (12:09 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Tue, 17 Apr 2012 02:12:32 +0000 (12:12 +1000)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
bin/run-parser.py [deleted file]
tools/README
tools/experimental_create.py [deleted file]

diff --git a/bin/run-parser.py b/bin/run-parser.py
deleted file mode 100755 (executable)
index 80ea86c..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-
-import gettext
-import sys
-import os.path
-import json
-
-possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
-                                   os.pardir,
-                                   os.pardir))
-if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
-    sys.path.insert(0, possible_topdir)
-
-gettext.install('heat', unicode=1)
-
-from heat.engine import parser
-
-parameter_count = 1
-
-
-def setparam(t, key, value):
-    global parameter_count
-    key_name = 'Parameters.member.%d.ParameterKey' % parameter_count
-    value_name = 'Parameters.member.%d.ParameterValue' % parameter_count
-
-    t[key_name] = key
-    t[value_name] = value
-    parameter_count += 1
-
-
-filename = sys.argv[1]
-with open(filename) as f:
-    json_blob = json.load(f)
-
-    (stack_name, tmp) = os.path.splitext(os.path.basename(filename))
-
-    params_dict = {}
-    setparam(params_dict, 'AWS::StackName', stack_name)
-
-# Don't immediately see a way to have key name as a parameter and also
-# file injection and monitoring
-# need to insert key on creation and know what private key is
-    setparam(params_dict, 'KeyName', 'sdake_key')
-    # ^ that gets inserted into image
-
-    setparam(params_dict, 'AWS::StackName', stack_name)
-    setparam(params_dict, 'InstanceType', 'm1.xlarge')
-    setparam(params_dict, 'DBUsername', 'eddie.jones')
-    setparam(params_dict, 'DBPassword', 'adm1n')
-    setparam(params_dict, 'DBRootPassword', 'admone')
-    setparam(params_dict, 'LinuxDistribution', 'F16')
-
-    # set the keystone auth environs up
-    username = os.environ['OS_USERNAME']
-    password = os.environ['OS_PASSWORD']
-    tenant = os.environ['OS_TENANT_NAME']
-    auth_url = os.environ['OS_AUTH_URL']
-
-    params_dict['KeyStoneCreds'] = dict(username=username,
-                                        password=password,
-                                        tenant=tenant,
-                                        auth_url=auth_url,
-                                        strategy='keystone')
-
-    stack = parser.Stack(stack_name, json_blob, params_dict)
-    stack.start()
index 53d97f62968193ae27b818a5b7d7b6bfaefda623..bc376c3f93e6479b33110781a7449d9cf8f68750 100644 (file)
@@ -8,10 +8,6 @@ http://fedoraproject.org/wiki/Getting_started_with_OpenStack_on_Fedora_17#Previe
 Tools
 -----
 
-+ experimental_create.py
-     - Example of creating an keypair and instantiating an instance after
-        one has been registered with JEOS create
-
 + experimental_ssh_eventlet.py
      - Example of using ssh inside python with eventlets.
 
diff --git a/tools/experimental_create.py b/tools/experimental_create.py
deleted file mode 100755 (executable)
index e1ebc59..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/python
-
-import eventlet
-from eventlet.green import socket
-import libssh2
-import time
-import os
-import random
-import base64
-import uuid
-import M2Crypto
-from novaclient.v1_1 import client
-
-def instance_start(instance_name, image_name, flavor_name):
-    """
-    Method to start an instance
-    """
-    def _null_callback(p, n, out):
-        """
-        Method to silence the default M2Crypto.RSA.gen_key output.
-        """
-        pass
-
-    private_key = M2Crypto.RSA.gen_key(2048, 65537, _null_callback)
-
-    # this is the binary public key, in ssh "BN" (BigNumber) MPI format.
-    # The ssh BN MPI format consists of 4 bytes that describe the length
-    # of the following data, followed by the data itself in big-endian
-    # format.  The start of the string is 0x0007, which represent the 7
-    # bytes following that make up 'ssh-rsa'.  The key exponent and
-    # modulus as fetched out of M2Crypto are already in MPI format, so
-    # we can just use them as-is.  We then have to base64 encode the
-    # result, add a little header information, and then we have a
-    # full public key.
-    username = os.environ['OS_USERNAME']
-    password = os.environ['OS_PASSWORD']
-    tenant = os.environ['OS_TENANT_NAME']
-    auth_url = os.environ['OS_AUTH_URL']
-    nova_client = client.Client(username, password, tenant, auth_url, service_type='compute', service_name='nova')
-    public_key_bn = '\x00\x00\x00\x07' + 'ssh-rsa' + private_key.e + private_key.n
-    public_key = 'ssh-rsa %s support@heat-api.org\n' % (base64.b64encode(public_key_bn))
-    private_key.save_key('/tmp/private_key', cipher=None)
-    random_uuid = uuid.uuid4()
-    key_uuid = uuid.uuid3(random_uuid, '%s %s %s' % (instance_name, image_name, flavor_name))
-    nova_client.keypairs.create(str(key_uuid), public_key)
-
-    image_list = nova_client.images.list()
-    for o in image_list:
-        if getattr(o, 'name', '') == image_name:
-            image_id = o.id #getattr(o, 'id', '')
-
-    flavor_list = nova_client.flavors.list()
-    for o in flavor_list:
-        if getattr(o, 'name', '') == flavor_name:
-            flavor_id = getattr(o, 'id', '')
-
-    nova_client.servers.create(name=instance_name, image=image_id,
-       flavor=flavor_id, key_name=str(key_uuid))
-
-    return private_key
-
-instance_start('instance-F16-test', 'F16-x86_64', "m1.tiny")
-