#!/usr/bin/env python
import os
import sys
import time
from launch_instance import launch_instance, get_opt_parser, ssh_command, scp_to_command, run_command, tag_instance
from optparse import OptionParser
from datetime import datetime

SCRIPT_DIR="../el6/"

if __name__ == "__main__":
    start = time.time()
    compose=1
    parser = OptionParser()
    parser = get_opt_parser(parser=parser)
    (opts, args) = parser.parse_args()
    instance = launch_instance(opts)
    if not instance or not hasattr(instance, "dns_name"):
        print "Failed to launch an instance. Will exit"
        sys.exit(1)
    hostname = instance.dns_name
    ssh_key = opts.ssh_key
    ssh_user = opts.ssh_user
    #
    # open firewall
    #
    print "Updating firewall rules"
    ssh_command(hostname, ssh_user, ssh_key, "mkdir -p ~/etc/sysconfig")
    scp_to_command(hostname, ssh_user, ssh_key, "./etc/sysconfig/iptables", "~/etc/sysconfig/iptables")
    ssh_command(hostname, ssh_user, ssh_key, "sudo mv ~/etc/sysconfig/iptables /etc/sysconfig/iptables")
    ssh_command(hostname, ssh_user, ssh_key, "sudo restorecon /etc/sysconfig/iptables")
#!/usr/bin/env python
import os
import sys
import time
from launch_instance import launch_instance, get_opt_parser, ssh_command, scp_to_command, run_command, tag_instance
from optparse import OptionParser
from datetime import datetime

SCRIPT_DIR = "../el6/"

if __name__ == "__main__":
    start = time.time()
    compose = 1
    parser = OptionParser()
    parser = get_opt_parser(parser=parser)
    (opts, args) = parser.parse_args()
    instance = launch_instance(opts)
    if not instance or not hasattr(instance, "dns_name"):
        print "Failed to launch an instance. Will exit"
        sys.exit(1)
    hostname = instance.dns_name
    ssh_key = opts.ssh_key
    ssh_user = opts.ssh_user
    #
    # open firewall
    #
    print "Updating firewall rules"
    ssh_command(hostname, ssh_user, ssh_key, "mkdir -p ~/etc/sysconfig")
    scp_to_command(hostname, ssh_user, ssh_key, "./etc/sysconfig/iptables",
                   "~/etc/sysconfig/iptables")
    ssh_command(hostname, ssh_user, ssh_key,
Esempio n. 3
0
#!/usr/bin/env python
import os
import sys
import time
from launch_instance import launch_instance, get_opt_parser, ssh_command, scp_to_command, run_command
from optparse import OptionParser

if __name__ == "__main__":
    start = time.time()

    parser = OptionParser()
    parser = get_opt_parser(parser=parser, vol_size=100)
    (opts, args) = parser.parse_args()
    instance = launch_instance(opts)
    hostname = instance.dns_name
    ssh_key = opts.ssh_key
    ssh_user = opts.ssh_user
    #
    # open firewall
    #
    print "Updating firewall rules"
    ssh_command(hostname, ssh_user, ssh_key, "mkdir -p ~/tmp")
    scp_to_command(hostname, ssh_user, ssh_key, "./etc/sysconfig/iptables", "~/tmp/")
    ssh_command(hostname, ssh_user, ssh_key, "sudo cp ~/tmp/iptables /etc/sysconfig/iptables")

    ssh_command(hostname, ssh_user, ssh_key, "sudo /sbin/service iptables restart")
    #
    # Run install script
    #
    print "Running install script for Pulp"
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/functions.sh", "~")