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")
 ssh_command(hostname, ssh_user, ssh_key,
             "sudo chown root:root /etc/sysconfig/iptables")
 ssh_command(hostname, ssh_user, ssh_key, "sudo service iptables restart")
 #
 # Copy scripts over
 #
 scp_to_command(hostname, ssh_user, ssh_key, "./env_vars", "~")
 scp_to_command(hostname, ssh_user, ssh_key, "./prepare.sh", "~")
 ssh_command(hostname, ssh_user, ssh_key, "chmod +x ./prepare.sh")
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", "~")
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/install_pulp.sh", "~")
    ssh_command(hostname, ssh_user, ssh_key, "sudo chmod +x ./install_pulp.sh")
    ssh_command(hostname, ssh_user, ssh_key, "time sudo ./install_pulp.sh &> ./pulp_rpm_setup.log ")
    #
    # Update EC2 tag with version of RCS installed
    #
 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")
 ssh_command(hostname, ssh_user, ssh_key, "sudo chown root:root /etc/sysconfig/iptables")
 ssh_command(hostname, ssh_user, ssh_key, "sudo service iptables restart")
 #
 # Copy scripts over
 #
 scp_to_command(hostname, ssh_user, ssh_key, "./env_vars", "~")
 scp_to_command(hostname, ssh_user, ssh_key, "%s/install_sam_splice_rpms.sh" % (SCRIPT_DIR), "~")
 ssh_command(hostname, ssh_user, ssh_key, "chmod +x ./install_sam_splice_rpms.sh")
 print "Install Katello + Splice RPMs"
 ssh_command(hostname, ssh_user, ssh_key, "time sudo ./install_sam_splice_rpms.sh &> ./install_sam_splice_rpms.log")
 #
 # Update EC2 tag with version of RCS installed
Exemple #4
0
 parser = OptionParser()
 parser.add_option('--product_data', action="store", default=default_product_data, 
         help="Product data for splice-certmaker: defaults to %s" % (default_product_data))
 parser = get_opt_parser(parser=parser)
 (opts, args) = parser.parse_args()
 instance = launch_instance(opts)
 hostname = instance.dns_name
 product_data = opts.product_data
 ssh_key = opts.ssh_key
 ssh_user = opts.ssh_user
 #
 # open firewall
 #
 print "Updating firewall rules"
 scp_to_command(hostname, ssh_user, ssh_key, "./etc/sysconfig/iptables", "/etc/sysconfig/iptables")
 ssh_command(hostname, ssh_user, ssh_key, "service iptables restart")
 #
 # Run install script
 #
 print "Running install script for RCS"
 scp_to_command(hostname, ssh_user, ssh_key, "./scripts/functions.sh", "~")
 scp_to_command(hostname, ssh_user, ssh_key, "./scripts/install_rpm_setup.sh", "~")
 scp_to_command(hostname, ssh_user, ssh_key, "./scripts/install_rcs.sh", "~")
 ssh_command(hostname, ssh_user, ssh_key, "chmod +x ./install_rpm_setup.sh")
 ssh_command(hostname, ssh_user, ssh_key, "time ./install_rpm_setup.sh &> ./splice_rpm_setup.log ")
 ssh_command(hostname, ssh_user, ssh_key, "time ./install_rcs.sh &> ./splice_rcs_install.log ")
 #
 # Upload product data to cert-maker
 #
 print "Uploading product_list data to splice-certmaker"
 cmd = "curl -X POST --data \"product_list=`cat %s`\"  http://%s:8080/productlist" % (product_data, hostname)
if __name__ == "__main__":
    start = time.time()
    parser = OptionParser()
    parser = get_opt_parser(parser=parser)
    (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"
    scp_to_command(hostname, ssh_user, ssh_key, "./etc/sysconfig/iptables", "/etc/sysconfig/iptables")
    ssh_command(hostname, ssh_user, ssh_key, "service iptables restart")
    #
    # Run install script
    #
    print "Running install script for ReportServer"
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/functions.sh", "~")
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/install_rpm_setup.sh", "~")
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/install_report_server.sh", "~")
    ssh_command(hostname, ssh_user, ssh_key, "chmod +x ./*.sh")
    ssh_command(hostname, ssh_user, ssh_key, "time ./install_rpm_setup.sh &> ./splice_rpm_setup.log ")
    ssh_command(hostname, ssh_user, ssh_key, "time ./install_report_server.sh &> ./splice_report_server_install.log ")
    #
    # Update EC2 tag with version of RCS installed
    #
    print "Update EC2 tag with RPM version of 'report-server' installed on %s" % (hostname)
    status, out, err = ssh_command(hostname, ssh_user, ssh_key, 'rpm -q --queryformat "%{VERSION}" report-server')
        print "Please re-run with '--sat_cert' pointing to a valid Satellite certificate"
        sys.exit(1)
    instance = launch_instance(opts)
    print "Instance %s is up: %s" % (instance.dns_name, datetime.now())
    hostname = instance.dns_name
    ssh_key = opts.ssh_key
    ssh_user = opts.ssh_user
    rhn_user = opts.rhn_user
    rhn_pass = opts.rhn_pass
    sat_cert = opts.sat_cert
    #
    # open firewall
    #
    print "Updating firewall rules"
    scp_to_command(hostname, ssh_user, ssh_key, "./etc/sysconfig/iptables", "/etc/sysconfig/iptables")
    ssh_command(hostname, ssh_user, ssh_key, "service iptables restart")
    #
    # Run install script
    #
    print "Running install script for Spacewalk: %s" % (datetime.now())
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/functions.sh", "~")
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/install_spacewalk.sh", "~")
    # <- note spacewalk installer doesn't like this answer file in "~", it's unable to expand the "~" 
    # and results in no answer file being found
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/spacewalk.answers", "/tmp/") 
    ssh_command(hostname, ssh_user, ssh_key, "chmod +x ./install_spacewalk.sh")
    ssh_command(hostname, ssh_user, ssh_key, "time ./install_spacewalk.sh &> ./spacewalk_rpm_setup.log ")

    # Begin CandlePin Install
    print "Beginning Candlepin Install: %s" % (datetime.now())
    scp_to_command(hostname, ssh_user, ssh_key, opts.manifest, "~/manifest.zip")
 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")
 ssh_command(hostname, ssh_user, ssh_key, "sudo chown root:root /etc/sysconfig/iptables")
 ssh_command(hostname, ssh_user, ssh_key, "sudo service iptables restart")
 #
 # Copy scripts over
 #
 scp_to_command(hostname, ssh_user, ssh_key, "./env_vars", "~")
 scp_to_command(hostname, ssh_user, ssh_key, "./prepare.sh", "~")
 ssh_command(hostname, ssh_user, ssh_key, "chmod +x ./prepare.sh")
 scp_to_command(hostname, ssh_user, ssh_key, "%s/../*.rb" % (SCRIPT_DIR), "~")
 scp_to_command(hostname, ssh_user, ssh_key, "%s/setup_katello_devel_env.sh" % (SCRIPT_DIR), "~")
 ssh_command(hostname, ssh_user, ssh_key, "chmod +x ./setup_katello_devel_env.sh")
 scp_to_command(hostname, ssh_user, ssh_key, "%s/setup_splice_rails_engine.sh" % (SCRIPT_DIR), "~")
if __name__ == "__main__":
    start = time.time()

    parser = OptionParser()
    parser = get_opt_parser(parser=parser)
    (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"
    scp_to_command(hostname, ssh_user, ssh_key, "./etc/sysconfig/iptables", "/etc/sysconfig/iptables")
    ssh_command(hostname, ssh_user, ssh_key, "service iptables restart")
    #
    # Run install script
    #
    print "Running install script for Spacewalk"
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/functions.sh", "~")
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/install_spacewalk.sh", "~")

    # <- note spacewalk installer doesn't like this answer file in "~", it's unable to expand the "~" 
    # and results in no answer file being found
    scp_to_command(hostname, ssh_user, ssh_key, "./scripts/spacewalk.answers", "/tmp/") 
    ssh_command(hostname, ssh_user, ssh_key, "chmod +x ./install_spacewalk.sh")
    ssh_command(hostname, ssh_user, ssh_key, "time ./install_spacewalk.sh &> ./spacewalk_rpm_setup.log ")

    #
    # Update EC2 tag with version of RCS installed