Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
        try:
            who = get_resource_holder(session, hostname, cluster)
            q.filter_by(holder=who).one()
        except NoResultFound, e:
            raise ArgumentError("there is no reboot_schedule defined")

        # More thorough check reboot_schedule and intervention
        # XXX TODO
        # i) detect week of month of start of intervention
        # ii) detect time
        # iii) compute week of application of reboot_schedule
        # iv) ... and time
        # v) test all the above doesn't conflict within 1hr of each other.

        # Setup intervention
        holder = get_resource_holder(session, hostname, cluster, compel=False)

        RebootIntervention.get_unique(session, name=intervention,
                                      holder=holder, preclude=True)

        dbiv = RebootIntervention(name=intervention,
                                  expiry_date=expire_when,
                                  start_date=start_when,
                                  users=allowusers,
                                  groups=allowgroups,
                                  disabled=disabled_actions,
                                  comments=comments,
                                  justification=justification)

        return add_resource(session, logger, holder, dbiv)
Ejemplo n.º 3
0
            q.filter_by(holder=who).one()
        except NoResultFound, e:
            raise ArgumentError("there is no reboot_schedule defined")

        # More thorough check reboot_schedule and intervention
        # XXX TODO
        # i) detect week of month of start of intervention
        # ii) detect time
        # iii) compute week of application of reboot_schedule
        # iv) ... and time
        # v) test all the above doesn't conflict within 1hr of each other.

        # Setup intervention
        holder = get_resource_holder(session, hostname, cluster, compel=False)

        RebootIntervention.get_unique(session,
                                      name=intervention,
                                      holder=holder,
                                      preclude=True)

        dbiv = RebootIntervention(name=intervention,
                                  expiry_date=expire_when,
                                  start_date=start_when,
                                  users=allowusers,
                                  groups=allowgroups,
                                  disabled=disabled_actions,
                                  comments=comments,
                                  justification=justification)

        return add_resource(session, logger, holder, dbiv)