Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
jlsherrill / Remove-pulp-tasks 2.4.md
Created February 12, 2015 20:31
Remove pulp tasks

To remove the finished pulp tasks:

# mongo
> use pulp_database
> db.task_status.remove({state:"finished"})
> quit()
@jlsherrill
jlsherrill / repos_in_pulp.md
Last active September 28, 2018 14:01
Repositories in pulp, not in katello

To see the list of repo ids in pulp that are not in katello:

# foreman-rake console

> User.current = User.anonymous_admin
> Katello.pulp_server.resources.repository.retrieve_all.map{|i| i['id']} - Katello::Repository.pluck(:pulp_id) - Katello::ContentViewPuppetEnvironment.pluck(:pulp_id)

To remove said repositories

> (Katello.pulp_server.resources.repository.retrieve_all.map{|i| i['id']} - Katello::Repository.pluck(:pulp_id) - Katello::ContentViewPuppetEnvironment.pluck(:pulp_id)).each{|pulp_id| Katello.pulp_server.resources.repository.delete(pulp_id)}
@skywalker-nick
skywalker-nick / neutron-ha-tool.py
Created January 31, 2014 06:44
Neutron HA tool for L3 and DHCP agents
#! /usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 AT&T Services, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
@skywalker-nick
skywalker-nick / l3_agent_scheduler.py
Last active August 29, 2015 13:55
Least Utilized Router Scheduler for OpenStack Neutron Havana Release
class LeastUtilizedScheduler(object):
"""Allocate a L3 agent for a new router that is the least utilized
in terms of router count
"""
def auto_schedule_routers(self, plugin, context, host, router_ids):
"""Schedule non-hosted routers to L3 Agent running on host.
If router_ids is given, each router in router_ids is scheduled
if it is not scheduled yet. Otherwise all unscheduled routers
are scheduled.
Don't schedule the routers which are hosted already