def render(self, session, logger, filesystem, hostname, cluster, resourcegroup, **arguments): holder = get_resource_holder(session, hostname, cluster, resourcegroup) dbfs = Filesystem.get_unique(session, name=filesystem, holder=holder, compel=True) del_resource(session, logger, dbfs) return
def render(self, session, logger, hostname, cluster, application, **arguments): holder = get_resource_holder(session, hostname, cluster) dbapp = Application.get_unique(session, name=application, holder=holder, compel=True) del_resource(session, logger, dbapp) return
def render(self, session, logger, hostname, cluster, resourcegroup, hostlink, **arguments): holder = get_resource_holder(session, hostname, cluster, resourcegroup) dbhl = Hostlink.get_unique(session, name=hostlink, holder=holder, compel=True) del_resource(session, logger, dbhl) return
def render(self, session, logger, share, hostname, resourcegroup, cluster, **arguments): holder = get_resource_holder(session, hostname, cluster, resourcegroup) dbshare = Share.get_unique(session, name=share, holder=holder, compel=True) del_resource(session, logger, dbshare) return
def render(self, session, logger, hostname, cluster, intervention, **arguments): validate_basic("intervention", intervention) holder = get_resource_holder(session, hostname, cluster) dbapp = Intervention.get_unique(session, name=intervention, holder=holder, compel=True) del_resource(session, logger, dbapp) return
def render(self, session, logger, filesystem, hostname, cluster, resourcegroup, **arguments): validate_basic("filesystem", filesystem) holder = get_resource_holder(session, hostname, cluster, resourcegroup) dbfs = Filesystem.get_unique(session, name=filesystem, holder=holder, compel=True) del_resource(session, logger, dbfs) return
def render(self, session, logger, hostname, cluster, application, **arguments): validate_basic("application", application) holder = get_resource_holder(session, hostname, cluster) dbapp = Application.get_unique(session, name=application, holder=holder, compel=True) del_resource(session, logger, dbapp) return
def render(self, session, logger, hostname, cluster, resourcegroup, hostlink, **arguments): validate_basic("hostlink", hostlink) holder = get_resource_holder(session, hostname, cluster) dbhl = Hostlink.get_unique(session, name=hostlink, holder=holder, compel=True) del_resource(session, logger, dbhl) return
def render(self, session, logger, share, hostname, resourcegroup, cluster, **arguments): validate_basic("share", share) holder = get_resource_holder(session, hostname, cluster, resourcegroup) dbshare = Share.get_unique(session, name=share, holder=holder, compel=True) del_resource(session, logger, dbshare) return
def render(self, session, logger, name, hostname, cluster, resourcegroup, keep_dns, **arguments): validate_basic("name", name) if name == "hostname": raise ArgumentError("The primary address of the host cannot " "be deleted.") holder = get_resource_holder(session, hostname, cluster, resourcegroup, compel=False) dbsrv = ServiceAddress.get_unique(session, name=name, holder=holder, compel=True) if isinstance(holder.holder_object, Host): oldinfo = DSDBRunner.snapshot_hw(holder.holder_object.machine) else: oldinfo = None dbdns_rec = dbsrv.dns_record for addr in dbsrv.assignments: addr.interface.assignments.remove(addr) session.expire(dbsrv, ['assignments']) session.flush() # Check if the address was assigned to multiple interfaces, and remove # the DNS entries if this was the last use q = session.query(AddressAssignment) q = q.filter_by(network=dbdns_rec.network) q = q.filter_by(ip=dbdns_rec.ip) other_uses = q.all() del_resource(session, logger, dbsrv, dsdb_callback=del_srv_dsdb_callback, oldinfo=oldinfo, keep_dns=other_uses or keep_dns) if not other_uses and not keep_dns: delete_dns_record(dbdns_rec) return
def render(self, session, logger, resourcegroup, hostname, cluster, **arguments): holder = get_resource_holder(session, hostname, cluster, compel=True) dbrg = ResourceGroup.get_unique(session, name=resourcegroup, holder=holder, compel=True) # Deleting service addresses can't be done with just cascading if dbrg.resholder: for res in dbrg.resholder.resources: if isinstance(res, ServiceAddress): raise ArgumentError("{0} contains {1:l}, please delete " "it first.".format(dbrg, res)) del_resource(session, logger, dbrg) return
def render(self, session, logger, hostname, cluster, **arguments): intervention = "reboot_intervention" holder = get_resource_holder(session, hostname, cluster) res = RebootIntervention.get_unique(session, name=intervention, holder=holder, compel=True) return del_resource(session, logger, res)
def render(self, session, logger, hostname, cluster, **arguments): reboot_schedule = "reboot_schedule" holder = get_resource_holder(session, hostname, cluster) res = RebootSchedule.get_unique(session, name=reboot_schedule, holder=holder, compel=True) return del_resource(session, logger, res)