def index(): client = LinodeClient('no-token', base_url=config.api_base_url) services = client.get_services(Service.label.contains("Linode")) datacenters = client.get_datacenters() stackscript = StackScript(client, config.stackscript_id) return render_template('configure.html', services=services, datacenters=datacenters, application_name=config.application_name, stackscript=stackscript)
def index(): client = LinodeClient('no-token') types = client.linode.get_types(Type.label.contains("Linode")) regions = client.get_regions() stackscript = StackScript(client, config.stackscript_id) return render_template('configure.html', types=types, regions=regions, application_name=config.application_name, stackscript=stackscript)
def create_linode(token, type_id, region_id, distribution_id): client = LinodeClient('{}'.format(token)) stackscript = StackScript(client, config.stackscript_id) (linode, password) = client.linode.create_instance(type_id, region_id, group=config.application_name, image=distribution_id, stackscript=stackscript.id) if not linode: raise RuntimeError("it didn't work") return linode, password
def create_linode(token, service_id, datacenter_id, distribution_id): client = LinodeClient('{}'.format(token), base_url=config.api_base_url) stackscript = StackScript(client, config.stackscript_id) service = Service(client, service_id) datacenter = Datacenter(client, datacenter_id) distro = Distribution(client, distribution_id) (linode, password) = client.create_linode(service, datacenter, group=config.application_name, source=distro, stackscript=stackscript.id) if not linode: raise RuntimeError("it didn't work") linode.boot() return linode, password