Bug 1505575

Summary: [modularity] I can unlock the module using the different module profile version than the locked one
Product: [Fedora] Fedora Reporter: Karel Srot <ksrot>
Component: dnfAssignee: Martin Hatina <mhatina>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 27CC: dmach, extras-qa, jmracek, mhatina, packaging-team-maint, rpm-software-management, vmukhame
Target Milestone: ---Keywords: NeedsTestCase, Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-07-25 06:30:31 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 Karel Srot 2017-10-23 21:49:55 UTC
Description of problem:

I can unlock a module profile version by referring a different version than the installed one.

See below.

Version-Release number of selected component (if applicable):
dnf-2.7.5-4.fc26.modularity.1.3fb9e5c.git.8052.52e0d41None.noarch

[root@0c7cc34dac27 /]# dnf module list --installed
Last metadata expiration check: 0:00:22 ago on Mon Oct 23 21:48:46 2017.
modularityABDE
Name               Stream           Version           Profiles                          
ModuleA            f26              2                 client, default [i], ...          

Hint: [d]efault, [i]nstalled, [l]ocked
[root@0c7cc34dac27 /]# dnf module lock ModuleA
Last metadata expiration check: 0:00:29 ago on Mon Oct 23 21:48:46 2017.
'ModuleA' is locked (stream: f26, version: 2)
[root@0c7cc34dac27 /]# dnf module unlock ModuleA:f26:1
Last metadata expiration check: 0:00:37 ago on Mon Oct 23 21:48:46 2017.
'ModuleA:f26:1' is unlocked

Comment 1 Martin Hatina 2017-10-24 07:58:48 UTC
It is correct behaviour. You only need stream to unlock version, because there can be only one version locked. Same for disabling module.

Comment 2 Karel Srot 2017-10-24 08:24:14 UTC
I disagree. While the information is not necessary it shouldn't be blindly ignored when it is incorrect. That applies both for version and stream. 
Even if dnf decide to accept that it should at least notify the user that the information provided is not correct and dnf is going to use just a module name.

At this particular situation is says:
  'ModuleA:f26:1' is unlocked
which is bogus as a different version was previously locked. It should rather say "ModuleA:f26:2" is unlocked

Comment 4 Karel Srot 2017-10-25 08:41:20 UTC
@QE: There is a test scenario related to this bug in module-lock-unlock-4.feature marked as @xfail.

Scenario: Unlocking a module:stream:version not matching a locked module:stream:version should fail

Once this bug is fixed the test scenario should be updated and enabled.

Comment 5 Martin Hatina 2018-07-25 06:30:31 UTC
Locking of modules was dropped.