Bug 668097

Summary: Repo arch should be checked against an enumeration
Product: [Retired] Pulp Reporter: Jay Dobies <jason.dobies>
Component: z_otherAssignee: Jason Dobies <jdobies>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: jortel, skarmark, tsanders
Target Milestone: ---Keywords: Triaged
Target Release: Sprint 21   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 13:59:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 647488    

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.