Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
            raise ArgumentError("the expiry value '%s' could not be "
                                "interpreted: %s" % (expiry, e))

        if start_time is None:
            start_when = datetime.utcnow().replace(microsecond=0)
        else:
            try:
                start_when = parse(start_time)
            except ValueError, e:
                raise ArgumentError("the start time '%s' could not be "
                                    "interpreted: %s" % (start_time, e))

        if start_when > expire_when:
            raise ArgumentError("the start time is later than the expiry time")

        holder = get_resource_holder(session, hostname, cluster, compel=False)

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

        dbiv = Intervention(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.º 4
0
        if start_time is None:
            start_when = datetime.utcnow().replace(microsecond=0)
        else:
            try:
                start_when = parse(start_time)
            except ValueError, e:
                raise ArgumentError("the start time '%s' could not be "
                                    "interpreted: %s" % (start_time, e))

        if start_when > expire_when:
            raise ArgumentError("the start time is later than the expiry time")

        holder = get_resource_holder(session, hostname, cluster, compel=False)

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

        dbiv = Intervention(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)