ospurge fails to find resources

Bug #1693409 reported by Curtis Collicutt
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
ospurge
Fix Committed
Undecided
Shi Yan

Bug Description

ospurge is not finding any resources to remove, even though they are there.

Here are a couple of resources:

$ os port show 95e681ce-8c1c-45a8-bc8d-e796bcb09a98 | grep project_id
| project_id | 6fa7c5d27b01404190a4fc77cbb16fd8 $ os security group show 6ed6e99f-cc5a-4e88-b473-59baa8b137a2 | grep project_id
| project_id | 6fa7c5d27b01404190a4fc77cbb16fd8

But when I use ospurge it only shows the users.

$ ospurge --verbose --purge-project 6fa7c5d27b01404190a4fc77cbb16fd8
WARNING:root:2017-05-25 03:34:04,637:Going to list and/or delete resources from project '6fa7c5d27b01404190a4fc77cbb16fd8'
WARNING:root:2017-05-25 03:34:05,057:Role 'Member' granted to user '9e535a1c6c8c473588e7b91946a61aa3' on project '6fa7c5d27b01404190a4fc77cbb16fd8'
WARNING:root:2017-05-25 03:34:05,519:Role 'Member' revoked from user '9e535a1c6c8c473588e7b91946a61aa3' on project '6fa7c5d27b01404190a4fc77cbb16fd8'
$

Am I using this incorrectly? This is an Ocata based cloud.

Revision history for this message
David Manchado (dmanchad) wrote :

I am having the same problem on a Newton based cloud.

Revision history for this message
Mathias Ewald (mewald) wrote :

Same here.

Revision history for this message
Andrew Price (andrpric) wrote :

I had the same problem targeting Ice House, Juno, and Mitaka clouds when trying to utilize virtualenv.

I was however able to address the issue. Below are some relevant ansible playbook configs:

- name: Download OSPurge git repo
  git:
    repo: 'https://github.com/openstack/ospurge.git'
    dest: '{{ git_repo_folder }}/ospurge'

- name: Install Packages for Python3
  yum:
    name: '{{ item }}'
    state: present
  with_items:
    - python34
    - python34-devel
    - python34-pip

- name: Install packages via pip3
  pip:
    name: '{{ item }}'
    state: present
    executable: pip3.4
  with_items:
    - os-client-config
    - pbr
    - shade
    - typing

- name: Check if OSPurge is installed
  shell: 'which ospurge'
  register: ospurge_installed
  ignore_errors: true
  changed_when: false

- name: Install OSPurge
  shell: 'python3.4 setup.py install'
  args:
    chdir: '{{ git_repo_folder }}/ospurge/'
  when: ospurge_installed.rc != 0

- name: Copy OSPurge bash script
  template:
    src: 'ospurge.sh.j2'
    dest: '{{ scripts_folder }}/ospurge.sh'
    mode: '0700'

### ospurge.sh.j2 ###
#!/bin/bash
set -e
source /root/openrc
cd {{ git_repo_folder }}/ospurge
ospurge --verbose --purge-own-project

Revision history for this message
Mathias Ewald (mewald) wrote :

Andrew, which part exactly solves the issue? I was not able run ospurge a single time up to today :(

Revision history for this message
Shi Yan (yanshi-403) wrote :

Hi, Mathias

That should be a bug in modules load function. The reason why Andrew makes it work is that he changes directory to the top level of the package.

So as a quick workaround, it should be working if you issue the ospurge command under the {{ git_repo_folder }}/ospurge

I've already submitted a fix for it at https://review.openstack.org/#/c/500468/

Shi Yan (yanshi-403)
Changed in ospurge:
assignee: nobody → Shi Yan (yanshi-403)
Revision history for this message
Jordan Pittier (jordan-pittier) wrote :

I've just approved https://review.openstack.org/#/c/500468/ which should fix this. If anyone could confirm that would be great. Thanks :)

Changed in ospurge:
status: New → Confirmed
Shi Yan (yanshi-403)
Changed in ospurge:
status: Confirmed → Fix Committed
Revision history for this message
Mathias Ewald (mewald) wrote :

Confirmed. Ospurge now discovers my resources, thanks!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.