Merge "Add queues deletion in RabbitMQ script"
This commit is contained in:
commit
54b8a0b583
|
@ -25,13 +25,20 @@ password = args.password
|
||||||
vhost = args.vhostname
|
vhost = args.vhostname
|
||||||
cl = Client(rabbitmq_url, rabbitmq_user, rabbitmq_password)
|
cl = Client(rabbitmq_url, rabbitmq_user, rabbitmq_password)
|
||||||
assert cl.is_alive()
|
assert cl.is_alive()
|
||||||
for i in cl.get_all_vhosts():
|
|
||||||
if i['name'] == vhost:
|
for queue in cl.get_queues():
|
||||||
cl.delete_vhost(i['name'])
|
if queue['vhost'] == vhost:
|
||||||
for i in cl.get_users():
|
cl.purge_queue(vhost, queue['name'])
|
||||||
if i['name'] == user:
|
cl.delete_queue(vhost, queue['name'])
|
||||||
cl.delete_user(i['name'])
|
|
||||||
|
for vhost_ in cl.get_all_vhosts():
|
||||||
|
if vhost_['name'] == vhost:
|
||||||
|
cl.delete_vhost(vhost_['name'])
|
||||||
|
|
||||||
|
for user_ in cl.get_users():
|
||||||
|
if user_['name'] == user:
|
||||||
|
cl.delete_user(user_['name'])
|
||||||
|
|
||||||
cl.create_vhost(vhost)
|
cl.create_vhost(vhost)
|
||||||
cl.create_user(user, password, tags='administrator')
|
cl.create_user(user, password, tags='administrator')
|
||||||
cl.set_vhost_permissions(vhost, user, '.*', '.*', '.*')
|
cl.set_vhost_permissions(vhost, user, '.*', '.*', '.*')
|
||||||
|
|
Loading…
Reference in New Issue