Bug 1561303

Summary: Random profiles shouldn't get enabled
Product: [Fedora] Fedora Reporter: sumantro <sumukher>
Component: dnfAssignee: rpm-software-management
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: 28CC: dmach, herrold, jmracek, packaging-team-maint, rpm-software-management, sgallagh, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-4.0.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-22 18:22:34 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:
Bug Depends On:    
Bug Blocks: 1478068    

Description sumantro 2018-03-28 04:35:45 UTC
Description of problem:
While enabling a module, the user can only use an enum list ['default', 'development', 'minimal'] using anything else should result in an error


Version-Release number of selected component (if applicable):


How reproducible:
Always


Steps to Reproduce:
1. 
2.
3.

Actual results:
Modules shouldn't get enabled


Expected results:
The user shouldn't be able to put random profile name and still enable the module in the first place


Additional info:
[root@localhost ~]# dnf module enable nodejs/bug                                                         
Last metadata expiration check: 0:29:23 ago on Wed 28 Mar 2018 09:27:01 AM IST.                          
'nodejs/bug' is enabled                                                                                  
[root@localhost ~]# dnf module enable nodejs:8/ada                                                       
Last metadata expiration check: 0:29:56 ago on Wed 28 Mar 2018 09:27:01 AM IST.                          
Enabling different stream for 'nodejs'                                                                   
Is this ok [y/N]: y                                                                                      
'nodejs:8/ada' is enabled                                                                                
[root@localhost ~]# dnf module enable nodejs:8/yummy                                                     
Last metadata expiration check: 0:30:12 ago on Wed 28 Mar 2018 09:27:01 AM IST.                          
'nodejs:8/yummy' is enabled                                                                              
[root@localhost ~]# dnf module install nodejs/yummy                                                      
Last metadata expiration check: 0:30:56 ago on Wed 28 Mar 2018 09:27:01 AM IST.                          
Error: No such profile: nodejs:8:20180308143646/yummy. Possible profiles: ['default', 'development', 'min
imal']

Comment 1 Stephen Gallagher 2018-03-28 17:00:47 UTC
When doing `dnf module enable`, we should probably do one of the following:

1) Disallow the `/profile` suffix to the module. It's meaningless during the enable step anyway. So we could throw an error if it's provided here.

2) Warn that the `/profile` was superfluous and then indicate the the base module was enabled.

3) Assume this to mean that the user wanted this profile to become the default for the stream and automatically write out a modulemd-defaults file for it in /etc.


I'm going to strongly recommend *against* 3, as I think we shouldn't be making implicit decisions about local default overrides. As far as the first two, I think 2) is probably the most user-friendly; it's informative but doesn't require them to retype anything.

Comment 2 Martin Hatina 2018-04-06 13:16:57 UTC
Best will be to go with option #2 from comment #1. It is more user friendly than option #1.

Comment 3 Martin Hatina 2018-07-24 13:45:07 UTC
Fixed in https://github.com/rpm-software-management/dnf/pull/1144