<commit_before>#!/usr/bin/python

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)

from heat.engine import parser


def setparam(t, key, value):
    if not t.has_key('Parameters'):
        t['Parameters'] = {}

    if not t['Parameters'].has_key(key):
        t['Parameters'][key] = {}

    t['Parameters'][key]['Value'] = value


filename = sys.argv[1]
with open(filename) as f:
    blob = json.load(f)

    (stack_name, tmp) = os.path.splitext(os.path.basename(filename))
    setparam(blob, '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(blob, 'KeyName', '309842309484') # <- that gets inserted into image

    setparam(blob, 'InstanceType', 't1.micro')
    setparam(blob, 'DBUsername', 'eddie.jones')
    setparam(blob, 'DBPassword', '<PASSWORD>')
    setparam(blob, 'DBRootPassword', '<PASSWORD>')
    setparam(blob, 'LinuxDistribution', 'F16')

    stack = parser.Stack(blob, stack_name)
    stack.start()<commit_msg>Fix order of parmeters issue<commit_after>#!/usr/bin/python

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)

from heat.engine import parser


def setparam(t, key, value):
    if not t.has_key('Parameters'):
        t['Parameters'] = {}

    if not t['Parameters'].has_key(key):
        t['Parameters'][key] = {}

    t['Parameters'][key]['Value'] = value


filename = sys.argv[1]
with open(filename) as f:
    blob = json.load(f)

    (stack_name, tmp) = os.path.splitext(os.path.basename(filename))
    setparam(blob, '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(blob, 'KeyName', '309842309484') # <- that gets inserted into image

    setparam(blob, 'InstanceType', 't1.micro')
    setparam(blob, 'DBUsername', 'eddie.jones')
    setparam(blob, 'DBPassword', '<PASSWORD>')
    setparam(blob, 'DBRootPassword', '<PASSWORD>')
    setparam(blob, 'LinuxDistribution', 'F16')

    stack = parser.Stack(stack_name, blob)
    stack.start()
{'fraction_non_alphanumeric': 0.14416392242956458, 'fraction_numerical': 0.013172338090010977, 'mean_word_length': 3.3328050713153723, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '63061', 'n_tokens_mistral': 933, 'n_tokens_neox': 890, 'n_words': 215}