Bug 1081091

Summary: Pulp fails to report filesystem permission denied errors when it cannot write the protected repos file
Product: [Retired] Pulp Reporter: Jason <ashbyj>
Component: API/integrationAssignee: pulp-bugs
Status: CLOSED UPSTREAM QA Contact: pulp-qe-list
Severity: low Docs Contact:
Priority: medium    
Version: 2.3CC: rbarlow, skarmark
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-28 22:04:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jason 2014-03-26 15:44:36 UTC
, I’m trying to update an existing repository with:

  pulp-admin rpm repo update --repo-id='Dev-CentOS65-updates-x86_64' --display-name='CentOS 6.5 updates - Dev environment'

which gives an error:

The server indicated one or more values were incorrect. The server provided the
following error message:

   Pulp exception occurred: PulpDataException

More information can be found in the client log file ~/.pulp/admin.log.


Heres ~/.pulp/admin.log:

2014-03-25 15:25:50,031 - ERROR - Exception occurred:
        href:      /pulp/api/v2/repositories/Dev-CentOS65-updates-x86_64/
        method:    PUT
        status:    400
        error:     Pulp exception occurred: PulpDataException
        traceback: None
        data:      {u'args': [[13, u'Permission denied']]}


I also tried with sudo in front, but I seem to get the same error.  Here is /var/log/pulp/pulp.log:


2014-03-25 15:28:22,061 pulp.server.webservices.middleware.exception:ERROR: Pulp exception occurred: PulpDataException
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/middleware/exception.py", line 44, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/middleware/postponed.py", line 39, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.6/site-packages/web/application.py", line 279, in wsgi
    result = self.handle_with_processors()
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 26, in _handle_with_processors
    return process(self.processors)
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in process
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/web/application.py", line 566, in processor
    return handler()
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in <lambda>
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in process
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/web/application.py", line 581, in processor
    result = handler()
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in <lambda>
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 25, in process
    return self.handle()
  File "/usr/lib/python2.6/site-packages/web/application.py", line 230, in handle
    return self._delegate(fn, self.fvars, args)
  File "/usr/lib/python2.6/site-packages/web/application.py", line 420, in _delegate
    return handle_class(cls)
  File "/usr/lib/python2.6/site-packages/web/application.py", line 396, in handle_class
    return tocall(*args)
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/decorators.py", line 227, in _auth_decorator
    value = method(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/repositories.py", line 288, in PUT
    repo = execution.execute(call_request)
  File "/usr/lib/python2.6/site-packages/pulp/server/dispatch/task.py", line 137, in _run
    result = call(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/managers/repo/cud.py", line 426, in update_repo_and_plugins
    distributor_manager.update_distributor_config(repo_id, dist_id, dist_config)
  File "/usr/lib/python2.6/site-packages/pulp/server/managers/repo/distributor.py", line 307, in update_distributor_config
    result = distributor_instance.validate_config(transfer_repo, call_config, config_conduit)
  File "/usr/lib/pulp/plugins/distributors/yum_distributor/distributor.py", line 195, in validate_config
    self.process_repo_auth_certificate_bundle(repo.id, repo_relative_path, auth_cert_bundle)
  File "/usr/lib/pulp/plugins/distributors/yum_distributor/distributor.py", line 262, in process_repo_auth_certificate_bundle
    protected_repo_utils_obj.delete_protected_repo(repo_relative_path)
  File "/usr/lib/python2.6/site-packages/pulp_rpm/repo_auth/protected_repo_utils.py", line 75, in delete_protected_repo
    f.save()
  File "/usr/lib/python2.6/site-packages/pulp_rpm/repo_auth/protected_repo_utils.py", line 155, in save
    f = open(self.filename, 'w')
PulpDataException: Pulp exception occurred: PulpDataException


I’m running pulp 2.3 (I believe that’s the stable version?) on CentOS 6.5.  I’m just getting started setting my pulp server and repositories up.  Here’s how I created the repos:
  
  pulp-admin rpm repo create --repo-id=CentOS65-updates-x86_64 --feed=http://mirror.umd.edu/centos/6.5/updates/x86_64 --max-speed=1000000 --max-downloads=2
  pulp-admin rpm repo sync run --repo-id=CentOS65-updates-x86_64

 # “freeze” the updates repo by copying to a separate repo
  pulp-admin rpm repo create --repo-id=Dev-CentOS65-updates-x86_64
  pulp-admin rpm repo copy all --from-repo-id=CentOS65-updates-x86_64 --to-repo-id=Dev-CentOS65-updates-x86_64
 pulp-admin rpm repo publish run --repo-id=Dev-CentOS65-updates-x86_64

That’s all good, but when I try to update the repository per above it errors out.  I have a vanilla install of the pulp-server, except for the SSL certs.  My pulp server is a sub/intermediary-CA of our root CA, so not sure if it’s a cert issue here.  My server and CA certs look good per openssl verify, curl, and apache checks.

Comment 1 Jason 2014-03-26 15:47:05 UTC
Reply from Randy Barlow:

>    File
> "/usr/lib/python2.6/site-packages/pulp_rpm/repo_auth/protected_repo_utils.py",
> line 155, in save
>
>      f = open(self.filename, 'w')
>
> PulpDataException: Pulp exception occurred: PulpDataException

Hi Jason,

This permission denied error is actually a Linux permission denied on
your protected repos file. In /etc/pulp/repo_auth.conf, there should be
a setting in the [repos] section for protected_repo_listing_file. Apache
will need write permissions to that path. Can you check the permissions?

By default, this path is /etc/pki/pulp/content/pulp-protected-repos. I 
think a reasonable argument could be made that this file belongs in /var 
rather than /etc, but that's a separate discussion.

If the permissions are not solid, can you comment back on whether you
have adjusted FS permissions, or whether these are the stock
permissions? It's possible that our spec file has these permissions wrong.

Also, it would be helpful if you could file a bug on the error reporting
here. It wasn't easy to determine what was causing the problem!

--
Randy Barlow
Raleigh, NC, USA

_______________________________________________
Pulp-list mailing list
Pulp-list
https://www.redhat.com/mailman/listinfo/pulp-list

Comment 2 Jason 2014-03-26 15:48:08 UTC
I had changed protected_repo_listing_file in /etc/pulp/repo_auth.conf to a custom path and you're right that my permissions were incorrect.  I ran chmod 755 on the content directory with owner:group as apache:apache and all looks good now!  Many thanks.

Comment 3 Randy Barlow 2014-03-27 14:05:10 UTC
Hi Jason, I'd like to keep this open because it would have been nice if Pulp had given you better information about what was wrong in this case. I renamed the bug to be about the error reporting.

Thanks for letting us know about this issue!

Comment 4 Brian Bouterse 2015-02-28 22:04:01 UTC
Moved to https://pulp.plan.io/issues/409