Ejemplo n.º 1
0
import time
import pyrax
import common as helper

# preliminary
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
cf = pyrax.cloudfiles
cdns = pyrax.cloud_dns

# takes a single parameter: container name to create
if len(sys.argv) < 2:
	print 'syntax: {0} <container_name>'.format(sys.argv[0])
        sys.exit(1)
else:
        valid_fqdn = helper.validate_fqdn(sys.argv[1])
        if valid_fqdn:
        	site_cont_name= sys.argv[1]
	else:
                print 'ERROR: the specified name contains invalid characters (see: RFC 1123 sec. 2.1)'
                sys.exit(1)

# check for container
cont = helper.act_loop(cf.get_container, site_cont_name)

# make container public, cdn enable container
helper.act_loop(cont.make_public, ttl=1200)

# create an index page for our container
index_page_content = "Welcome to Ryan's test site on the rack cloud CDN!"
obj = helper.act_loop(cf.store_object, site_cont_name, "index.htm", index_page_content)
Ejemplo n.º 2
0
import re
import time
import common as helper
import pyrax

# preliminary
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
cdns = pyrax.cloud_dns

# take three parameters: 1: your hosted domain 2: a valid hostname (e.g.: www), 3: a valid IPv4 address
if len(sys.argv) < 3:
    print "{0}: <domain> <host> <ipv4address>".format(sys.argv[0])
    sys.exit(1)

valid_fqdn = helper.validate_fqdn(sys.argv[1])
valid_host = helper.validate_fqdn(sys.argv[2])
valid_ipv4 = helper.validate_ipv4(sys.argv[3])

# use helper function to ensure that the specified domain is valid
if valid_fqdn:
    valid_fqdn = sys.argv[1]
    print valid_fqdn, "seems valid, but I have not verified this on remote server yet.."
else:
    print "ERROR: invalid characters in your FQDN"
    sys.exit(1)

# use helper function to ensure that the specified hostname is valid
if valid_host:
    valid_host = sys.argv[2]
    print "validated host:", valid_host, "successfully"
Ejemplo n.º 3
0
import time
import pyrax
import common as helper

# preliminary
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
cf = pyrax.cloudfiles
cdns = pyrax.cloud_dns

# takes a single parameter: container name to create
if len(sys.argv) < 2:
    print 'syntax: {0} <container_name>'.format(sys.argv[0])
    sys.exit(1)
else:
    valid_fqdn = helper.validate_fqdn(sys.argv[1])
    if valid_fqdn:
        site_cont_name = sys.argv[1]
    else:
        print 'ERROR: the specified name contains invalid characters (see: RFC 1123 sec. 2.1)'
        sys.exit(1)

# check for container
cont = helper.act_loop(cf.get_container, site_cont_name)

# make container public, cdn enable container
helper.act_loop(cont.make_public, ttl=1200)

# create an index page for our container
index_page_content = "Welcome to Ryan's test site on the rack cloud CDN!"
obj = helper.act_loop(cf.store_object, site_cont_name, "index.htm",
Ejemplo n.º 4
0
import re
import time
import common as helper
import pyrax

# preliminary
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
cdns = pyrax.cloud_dns

# take three parameters: 1: your hosted domain 2: a valid hostname (e.g.: www), 3: a valid IPv4 address
if len(sys.argv) < 3:
    print '{0}: <domain> <host> <ipv4address>'.format(sys.argv[0])
    sys.exit(1)

valid_fqdn = helper.validate_fqdn(sys.argv[1])
valid_host = helper.validate_fqdn(sys.argv[2])
valid_ipv4 = helper.validate_ipv4(sys.argv[3])

# use helper function to ensure that the specified domain is valid
if valid_fqdn:
    valid_fqdn = sys.argv[1]
    print valid_fqdn, 'seems valid, but I have not verified this on remote server yet..'
else:
    print 'ERROR: invalid characters in your FQDN'
    sys.exit(1)

# use helper function to ensure that the specified hostname is valid
if valid_host:
    valid_host = sys.argv[2]
    print 'validated host:', valid_host, 'successfully'