def finish(self, single_service=None): """handles deployment Arguments: single_service: a dict for the service that was just configured. finish will schedule a deploy for it and call render() again to display the next one. if service is None, schedules deploys for all remaining services, schedules relations, then continues to next controller """ if single_service: juju.deploy_service(single_service, app.ui.set_footer, partial(self._handle_exception, "ED")) self.svc_idx += 1 return self.render() else: for service in self.services[self.svc_idx:]: juju.deploy_service(service, app.ui.set_footer, partial(self._handle_exception, "ED")) juju.set_relations(self.services, app.ui.set_footer, partial(self._handle_exception, "ED")) if app.bootstrap.running and not app.bootstrap.running.done(): return controllers.use('bootstrapwait').render() else: return controllers.use('deploystatus').render() utils.pollinate(app.session_id, 'PC')
def do_deploy(self, application, msg_cb): "launches deploy in background for application" self.undeployed_applications.remove(application) def msg_both(*args): msg_cb(*args) app.ui.set_footer(*args) juju.deploy_service(application, msg_cb=msg_both, exc_cb=partial(self._handle_exception, "ED"))
def finish(self): """ handles deployment """ for service in self.applications: juju.deploy_service(service, app.metadata_controller.series, utils.info, partial(self.__handle_exception, "ED")) f = juju.set_relations(self.applications, utils.info, partial(self.__handle_exception, "ED")) concurrent.futures.wait([f]) controllers.use('deploystatus').render()
def finish(self): """ handles deployment """ for service in self.applications: juju.deploy_service(service, utils.info, partial(self.__handle_exception, "ED")) f = juju.set_relations(self.applications, utils.info, partial(self.__handle_exception, "ED")) concurrent.futures.wait([f]) utils.pollinate(app.session_id, 'PC') controllers.use('deploystatus').render()
def finish(self): """ handles deployment """ for service in self.services: juju.deploy_service(service, utils.info, partial(self.__handle_exception, "ED")) f = juju.set_relations(self.services, utils.info, partial(self.__handle_exception, "ED")) concurrent.futures.wait([f]) utils.pollinate(app.session_id, 'PC') controllers.use('deploystatus').render()
async def do_deploy(msg_cb): await events.ModelConnected.wait() cloud_types = juju.get_cloud_types_by_name() default_series = app.metadata_controller.series machines = app.metadata_controller.bundle.machines applications = sorted(app.metadata_controller.bundle.services, key=attrgetter('service_name')) await pre_deploy(msg_cb=msg_cb) machine_map = await juju.add_machines(applications, machines, msg_cb=msg_cb) tasks = [] for service in applications: if cloud_types[app.provider.cloud] == "localhost": # ignore placement when deploying to localhost service.placement_spec = None elif service.placement_spec: # remap machine references to actual deployed machine IDs # (they will only ever not already match if deploying to # an existing model that has other machines) new_placements = [] for plabel in service.placement_spec: if ':' in plabel: ptype, pid = plabel.split(':') new_placements.append(':'.join([ptype, machine_map[pid]])) else: new_placements.append(machine_map[plabel]) service.placement_spec = new_placements tasks.append( juju.deploy_service(service, default_series, msg_cb=msg_cb)) tasks.append(juju.set_relations(service, msg_cb=msg_cb)) await asyncio.gather(*tasks) events.DeploymentComplete.set()
async def do_deploy(self): cloud_types = juju.get_cloud_types_by_name() default_series = app.metadata_controller.series machines = app.metadata_controller.bundle.machines applications = sorted(app.metadata_controller.bundle.services, key=attrgetter('service_name')) await common.pre_deploy(msg_cb=utils.info) await juju.add_machines(applications, machines, msg_cb=utils.info) tasks = [] for service in applications: # ignore placement when deploying to localhost if cloud_types[app.current_cloud] == "localhost": service.placement_spec = None tasks.append( juju.deploy_service(service, default_series, msg_cb=utils.info)) tasks.append(juju.set_relations(service, msg_cb=utils.info)) await asyncio.gather(*tasks) events.DeploymentComplete.set() controllers.use('deploystatus').render()
def do_deploy_remaining(self, sender): "deploys all un-deployed applications" for application in self.undeployed_applications: juju.deploy_service(application, app.ui.set_footer, partial(self._handle_exception, "ED"))