Bug 668097 - Repo arch should be checked against an enumeration
Summary: Repo arch should be checked against an enumeration
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
: Sprint 21
Assignee: Jason Dobies
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks: verified-to-close
TreeView+ depends on / blocked
 
Reported: 2011-01-07 21:34 UTC by Jay Dobies
Modified: 2011-08-16 13:59 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-16 13:59:16 UTC
Embargoed:


Attachments (Terms of Use)

Description Jay Dobies 2011-01-07 21:34:54 UTC
There is no validation done when indicating a repo's arch with --arch. We should validate that the user hasn't made a mistake and flagged a repo as, for instance, x86_65.

Comment 1 Jay Dobies 2011-02-21 16:21:35 UTC
commit	dc6e77c8da53066bd91703973a659656b5ed1051
tree	ce00e5d1c8f1421fe50d04d854ff0c92977d5976


668097 - Added enumerated value set and checking for arch when creating a repo.


src/pulp/server/api/repo.py
src/pulp/server/db/model/resource.py
test/unit/test_api.py


Note: the error message is still the un-pretty traceback. I didn't address that here since it's covered by a bigger exception initiative. But the traceback should still indicate the arch was incorrect and list out the possible arches.



Example Usage:

$ pulp-admin repo create --id foo-1 --arch foo
error: operation failed: Traceback (most recent call last):
  File "/home/jdob/code/pulp/src/pulp/server/webservices/controllers/base.py", line 52, in report_error
    return method(self, *args, **kwargs)
  File "/home/jdob/code/pulp/src/pulp/server/compat.py", line 40, in _decorator
    return decorator(*args,**kwargs)
  File "/home/jdob/code/pulp/src/pulp/server/webservices/controllers/base.py", line 131, in _auth_decorator
    value = method(self, *args, **kwargs)
  File "/home/jdob/code/pulp/src/pulp/server/webservices/controllers/repositories.py", line 103, in POST
    gpgkeys=repo_data.get('gpgkeys', None),)
  File "/home/jdob/code/pulp/src/pulp/server/compat.py", line 40, in _decorator
    return decorator(*args,**kwargs)
  File "/home/jdob/code/pulp/src/pulp/server/auditing.py", line 207, in _audit
    result = method(*args, **kwargs)
  File "/home/jdob/code/pulp/src/pulp/server/api/repo.py", line 150, in create
    raise PulpException('Architecture must be one of [%s]' % ', '.join(model.Repo.SUPPORTED_ARCHS))
PulpException: 'Architecture must be one of [noarch, i386, i686, ppc64, s390x, x86_64]'


$ pulp-admin repo create --id foo-1 --arch i386
Successfully created repository [ foo-1 ]

Comment 2 Jeff Ortel 2011-02-22 14:32:12 UTC
Build: 0.140

Comment 3 Preethi Thomas 2011-05-05 19:08:04 UTC
[root@preethi ~]# rpm -q pulp
pulp-0.0.173-1.fc14.noarch
[root@preethi ~]# 
[root@preethi ~]# pulp-admin repo create --id foo-1 --arch foo
error: operation failed: PulpException: 'Architecture must be one of [noarch, i386, i686, ppc64, s390x, x86_64]'
[root@preethi ~]# 
[root@preethi ~]# 
[root@preethi ~]# 
[root@preethi ~]# pulp-admin repo create --id foo-1 --arch i386
Successfully created repository [ foo-1 ]

Comment 4 Preethi Thomas 2011-08-16 13:59:16 UTC
Closing with Community Release 15

pulp-0.0.223-4.


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