Bug 801928 - [Upgrade] permission denied deleting repo's
[Upgrade] permission denied deleting repo's
Status: CLOSED CURRENTRELEASE
Product: Pulp
Classification: Community
Component: z_other (Show other bugs)
2.0.6
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: James Slagle
Preethi Thomas
:
Depends On: 801174
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-09 16:04 EST by James Slagle
Modified: 2013-04-08 11:58 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 801174
Environment:
Last Closed: 2013-04-08 11:58:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description James Slagle 2012-03-09 16:04:00 EST
+++ This bug was initially created as a clone of Bug #801174 +++

Description of problem:

Trying to remove some repo's after running an upgrade from RHUI 2.0.1 -> 2.0.2

I don't think this is a major issue, customer could go into mongo if needed to remove a repo.


recreate:
1. setup rhui 2.0.1 w/ repos x,y,z
2. migrate to  rhui 2.0.2 using https://engineering.redhat.com/trac/mgmt-integrated/wiki/cloude/rhui-202-release-notes
3. using rhui-manager delete some repos.

I tried working around the issue by chowning the cert file to apache (guessing there)

 ------------------------------------------------------------------------------
rhui (repo) => l

Custom Repositories
  wes-custom2

Red Hat Repositories
  Red Hat Update Infrastructure 1.2 (RPMs) (5Server-x86_64)
  Red Hat Update Infrastructure 2.0 (RPMs) (6Server-x86_64)


------------------------------------------------------------------------------
rhui (repo) => ^C

2012-03-07 15:35:51,329 31038:140620479813376: pulp.server.api.repo:INFO: repo:644 removing repo files .... /var/lib/pulp//repos/content/wes-custom2
2012-03-07 15:35:51,329 31038:140620479813376: pulp.repo_auth.repo_cert_utils:INFO: repo_cert_utils:111 Deleting certificate bundles at [/etc/pki/pulp/content/wes-custom2]
2012-03-07 15:35:51,379 31038:140620479813376: pulp.server.tasking.task:ERROR: task:474 Task failed: Task 2115f759-6895-11e1-bd40-bc305bc26812: RepoApi.delete(wes-custom2, )
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/tasking/task.py", line 420, in run
    result = self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 652, in delete
    repo_cert_utils.delete_for_repo(id)
  File "/usr/lib/python2.6/site-packages/pulp/repo_auth/repo_cert_utils.py", line 112, in delete_for_repo
    shutil.rmtree(repo_dir)
  File "/usr/lib64/python2.6/shutil.py", line 217, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/usr/lib64/python2.6/shutil.py", line 215, in rmtree
    os.remove(fullname)
OSError: [Errno 13] Permission denied: '/etc/pki/pulp/content/wes-custom2/consumer-wes-custom2.ca'



[root@dhcp231-185 admin]# ll /etc/pki/pulp/content/wes-custom2/consumer-wes-custom2.ca
-rw-r--r--. 1 apache root 1212 Mar  7 12:13 /etc/pki/pulp/content/wes-custom2/consumer-wes-custom2.ca
[root@dhcp231-185 admin]# chown apache:apache /etc/pki/pulp/content/wes-custom2/consumer-wes-custom2.ca
[root@dhcp231-185 admin]# 


2012-03-07 15:39:07,260 31038:140620479813376: pulp.server.api.repo:INFO: repo:644 removing repo files .... /var/lib/pulp//repos/content/dist/rhel/rhui/server/5/5Server/x86_64/rhui/1.2/os
2012-03-07 15:39:07,262 31038:140620479813376: pulp.repo_auth.repo_cert_utils:INFO: repo_cert_utils:111 Deleting certificate bundles at [/etc/pki/pulp/content/rhel-x86_64-5-rhui-1-rpms-5Server-x86_64]
2012-03-07 15:39:07,263 31038:140620479813376: pulp.server.tasking.task:ERROR: task:474 Task failed: Task 95cc0b00-6895-11e1-ba21-bc305bc26812: RepoApi.delete(rhel-x86_64-5-rhui-1-rpms-5Server-x86_64, )
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/tasking/task.py", line 420, in run
    result = self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 652, in delete
    repo_cert_utils.delete_for_repo(id)
  File "/usr/lib/python2.6/site-packages/pulp/repo_auth/repo_cert_utils.py", line 112, in delete_for_repo
    shutil.rmtree(repo_dir)
  File "/usr/lib64/python2.6/shutil.py", line 217, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/usr/lib64/python2.6/shutil.py", line 215, in rmtree
    os.remove(fullname)
OSError: [Errno 13] Permission denied: '/etc/pki/pulp/content/rhel-x86_64-5-rhui-1-rpms-5Server-x86_64/consumer-rhel-x86_64-5-rhui-1-rpms-5Server-x86_64.ca'

--- Additional comment from jslagle@redhat.com on 2012-03-07 16:52:21 EST ---

committed to pulp rhui:   3da4e8715b5d4448bfc5a5080baef10e3d48a201

built into pulp-0.263-17

--- Additional comment from jslagle@redhat.com on 2012-03-07 17:13:24 EST ---

Newer ISO build:
http://download.lab.bos.redhat.com/devel/candidates/RHEL-6.2-RHUI-2.0.2-20120307.
+2/2.0.2/Server/x86_64/iso/RHEL-6.2-RHUI-2.0.2-20120307.2-Server-x86_64-DVD1.iso

yum repo on cdn.rcm-qa also updated.

--- Additional comment from kbidarka@redhat.com on 2012-03-08 10:40:54 EST ---

2012-03-08 15:02:19,501 25938:139849854068480: pulp.server.tasking.task:ERROR: task:474 Task failed: Task 99c300b3-6901-11e1-9e0c-525400856f10: RepoApi.delete(rhel-x86_64-6-rhui-2-rpms-6Server-x86_64, )
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/tasking/task.py", line 420, in run
    result = self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo.py", line 652, in delete
    repo_cert_utils.delete_for_repo(id)
  File "/usr/lib/python2.6/site-packages/pulp/repo_auth/repo_cert_utils.py", line 112, in delete_for_repo
    shutil.rmtree(repo_dir)
  File "/usr/lib64/python2.6/shutil.py", line 217, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/usr/lib64/python2.6/shutil.py", line 215, in rmtree
    os.remove(fullname)
OSError: [Errno 13] Permission denied: '/etc/pki/pulp/content/rhel-x86_64-6-rhui-2-rpms-6Server-x86_64/consumer-rhel-x86_64-6-rhui-2-rpms-6Server-x86_64.cert'


[root@scalpel pulp]# rpm -qav | grep -i pulp
pulp-0.0.263-17.el6.noarch
python-isodate-0.4.4-4.pulp.el6.noarch
m2crypto-0.21.1.pulp-7.el6.x86_64
pulp-client-lib-0.0.263-17.el6.noarch
python-oauth2-1.5.170-2.pulp.el6.noarch
pulp-selinux-server-0.0.263-17.el6.noarch
mod_wsgi-3.3-2.pulp.el6.x86_64
pulp-consumer-0.0.263-17.el6.noarch
pulp-common-0.0.263-17.el6.noarch
pulp-admin-0.0.263-17.el6.noarch

--- Additional comment from kbidarka@redhat.com on 2012-03-08 10:42:57 EST ---

-= Repository Management =-

   l   list repositories currently managed by the RHUI
   i   display detailed information on a repository
   a   add a new Red Hat content repository
   c   create a new custom repository
   d   delete a repository from the RHUI
   u   upload content to a custom repository
   p   list packages in a repository

                                     Connected: scalpel.lab.eng.pnq.redhat.com
------------------------------------------------------------------------------
rhui (repo) => d

Select one or more repositories:

  Custom Repositories
    -  1 : apache
    -  2 : httpd_custom
    -  3 : zsh_custom

  Red Hat Repositories
    -  4 : Red Hat Update Infrastructure 2.0 (RPMs) (6Server-x86_64)
    -  5 : Red Hat Update Infrastructure 2.0 (Source RPMs) (6Server-x86_64)

Enter value (1-5) to toggle selection, 'c' to confirm selections, or '?' for more commands: 4

Select one or more repositories:

  Custom Repositories
    -  1 : apache
    -  2 : httpd_custom
    -  3 : zsh_custom

  Red Hat Repositories
    x  4 : Red Hat Update Infrastructure 2.0 (RPMs) (6Server-x86_64)
    -  5 : Red Hat Update Infrastructure 2.0 (Source RPMs) (6Server-x86_64)

Enter value (1-5) to toggle selection, 'c' to confirm selections, or '?' for more commands: c


The following repositories will be deleted:
  Red Hat Repositories
    Red Hat Update Infrastructure 2.0 (RPMs) (6Server-x86_64)

Proceed? (y/n) y


Deleting Red Hat Update Infrastructure 2.0 (RPMs) (6Server-x86_64)...

------------------------------------------------------------------------------
rhui (repo) => exit

[root@dhcp201-152 log]# rhui-manager


------------------------------------------------------------------------------
             -= Red Hat Update Infrastructure Management Tool =-


-= Home =-

   r   manage repositories
   c   manage content delivery servers (CDS)
   s   synchronization status and scheduling
   e   create entitlement certificates and client configuration RPMs
   n   manage Red Hat entitlement certificates
   u   manage users
   i   manage identity certificate

   logout
       removes stored authentication credentials and exits

   <   move to the previous screen
   ^, home
       move to the home screen
   /, clear
       clears the screen
   ?, help
       display help
   q, quit, exit
       exit

                                     Connected: scalpel.lab.eng.pnq.redhat.com
------------------------------------------------------------------------------
rhui (home) => r




------------------------------------------------------------------------------
             -= Red Hat Update Infrastructure Management Tool =-


-= Repository Management =-

   l   list repositories currently managed by the RHUI
   i   display detailed information on a repository
   a   add a new Red Hat content repository
   c   create a new custom repository
   d   delete a repository from the RHUI
   u   upload content to a custom repository
   p   list packages in a repository

                                     Connected: scalpel.lab.eng.pnq.redhat.com
------------------------------------------------------------------------------
rhui (repo) => l

Custom Repositories
  zsh_custom
  httpd_custom
  apache

Red Hat Repositories
  Red Hat Update Infrastructure 2.0 (RPMs) (6Server-x86_64)
  Red Hat Update Infrastructure 2.0 (Source RPMs) (6Server-x86_64)


------------------------------------------------------------------------------
rhui (repo) => exit
[root@dhcp201-152 log]# rpm -qav | grep -i pulp
pulp-client-lib-0.0.263-17.el6.noarch
pulp-common-0.0.263-17.el6.noarch
pulp-consumer-0.0.263-17.el6.noarch
pulp-admin-0.0.263-17.el6.noarch
m2crypto-0.21.1.pulp-7.el6.x86_64
python-isodate-0.4.4-4.pulp.el6.noarch

--- Additional comment from kbidarka@redhat.com on 2012-03-08 11:00:31 EST ---

[root@xxxxxxx pulp]# ll /etc/pki/pulp/content/rhel-x86_64-6-rhui-2-rpms-6Server-x86_64/consumer-rhel-x86_64-6-rhui-2-rpms-6Server-x86_64.cert
-rw-r--r--. 1 apache apache 2923 Mar  8 08:51 /etc/pki/pulp/content/rhel-x86_64-6-rhui-2-rpms-6Server-x86_64/consumer-rhel-x86_64-6-rhui-2-rpms-6Server-x86_64.cert

--- Additional comment from jslagle@redhat.com on 2012-03-09 12:30:57 EST ---

Even though the file permissions were fixed on the certs themseleves, the directory still had wrong permissions.

After I fixed that, I noticed that the SELinux contexts also weren't applied correctly b/c we were moving the files instead of copying them.  I switched from using shutil.move to shutil.copy in the code.

committed to pulp rhui:
ea39604539dea26ccff11267de4aade55db3b144

built into pulp-0.263-18

--- Additional comment from jslagle@redhat.com on 2012-03-09 13:54:31 EST ---

Even newer ISO build:
http://download.lab.bos.redhat.com/devel/candidates/RHEL-6.2-RHUI-2.0.2-20120309.
+0/2.0.2/Server/x86_64/iso/RHEL-6.2-RHUI-2.0.2-20120309.0-Server-x86_64-DVD1.iso

yum repo on cdn.rcm-qa also updated.
Comment 1 James Slagle 2012-03-09 16:37:16 EST
cherry picked to pulp master 7c4acdc7acfd667efd91a478cdd97cdea4ffd66c
Comment 2 James Slagle 2012-03-09 16:38:35 EST
this required fixing migration version 33
Comment 3 Jeff Ortel 2012-03-09 20:32:38 EST
build: 0.273
Comment 4 Preethi Thomas 2012-11-05 14:49:31 EST
Need to verify this after the pulp-upgrade
Comment 5 Preethi Thomas 2013-03-28 22:56:30 EDT
verified
v1->v2 upgrade
[root@ibm-x3550m3-13 ~]# pulp-admin repo list
+----------------------------------------------------------------------+
                              Repositories
+----------------------------------------------------------------------+

Id:                  rhel6-4
Display Name:        rhel6-4
Description:         None
Content Unit Counts: 
  Distribution:     1
  Erratum:          1730
  Package Category: 10
  Package Group:    202
  Rpm:              7865

Id:                  zoo
Display Name:        zoo
Description:         None
Content Unit Counts: 
  Erratum:          4
  Package Category: 1
  Package Group:    2
  Rpm:              32

Id:                  pulp-unittest
Display Name:        pulp-unittest
Description:         None
Content Unit Counts: 
  Distribution:     1
  Erratum:          52
  Package Category: 2
  Package Group:    3
  Rpm:              3


[root@ibm-x3550m3-13 ~]# pulp-admin rpm repo delete --repo-id pulp-unittest
The request to delete repository [pulp-unittest] has been received by the
server. The progress of the task can be viewed using the commands under "repo
tasks"
[root@ibm-x3550m3-13 ~]# pulp-admin repo list
+----------------------------------------------------------------------+
                              Repositories
+----------------------------------------------------------------------+

Id:                  rhel6-4
Display Name:        rhel6-4
Description:         None
Content Unit Counts: 
  Distribution:     1
  Erratum:          1730
  Package Category: 10
  Package Group:    202
  Rpm:              7865

Id:                  zoo
Display Name:        zoo
Description:         None
Content Unit Counts: 
  Erratum:          4
  Package Category: 1
  Package Group:    2
  Rpm:              32


[root@ibm-x3550m3-13 ~]#
Comment 6 Preethi Thomas 2013-04-08 11:58:44 EDT
Pulp 2.1 released 


http://www.pulpproject.org/2013/04/05/pulp-2-1-0-released/

Note You need to log in before you can comment on or make changes to this bug.