Bug 1755028 - dnf module: Changing a behavior of "dnf module install $name:$stream" in case of there is no default module profile
Summary: dnf module: Changing a behavior of "dnf module install $name:$stream" in case...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-24 14:49 UTC by Jun Aruga
Modified: 2019-09-27 14:38 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-09-27 12:23:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Pagure modularity issue 154 0 None None None 2019-09-24 14:49:46 UTC

Description Jun Aruga 2019-09-24 14:49:46 UTC
Description of problem:

When running "dnf module install $name:$stream" that does not have the default module profile, the command exists successfully with the exist status: 0 enabling the stream.
It's done successfully even when the default profile is not found, and the RPMs in the module are not installed.

Shall we change the behavior not to enable the module stream, and just to return an exist code non-zero?
Because it's hard to find the issue in a script like https://travis-ci.org/junaruga/switch-module-stream/jobs/587097018#L254 .

This ticket is originally from https://pagure.io/modularity/issue/154 .


Version-Release number of selected component (if applicable):
# rpm -q dnf
dnf-4.2.7-2.fc30.noarch

But I assume it also happens on the latest dnf.


How reproducible:


Steps to Reproduce:
1. $ podman run --rm -it fedora:30 bash

2. Run following commands.

```
[root@92ee7f81b239 /]# dnf module install perl:5.28
Last metadata expiration check: 0:00:28 ago on Tue Sep 24 14:43:05 2019.
No default profiles for module perl:5.28
Dependencies resolved.
==============================================================================================
 Package               Architecture         Version               Repository             Size
==============================================================================================
Enabling module streams:
 perl                                       5.28                                             

Transaction Summary
==============================================================================================

Is this ok [y/N]: y
Complete!

[root@92ee7f81b239 /]# echo $?
0

[root@92ee7f81b239 /]# dnf module list perl
Last metadata expiration check: 0:01:51 ago on Tue Sep 24 14:43:05 2019.
Fedora Modular 30 - x86_64
Name       Stream         Profiles               Summary                                      
perl       5.26           default, minimal       Practical Extraction and Report Language     

Fedora Modular 30 - x86_64 - Updates
Name       Stream         Profiles               Summary                                      
perl       5.26           default, minimal       Practical Extraction and Report Language     
perl       5.28 [e]       default, minimal       Practical Extraction and Report Language     
perl       5.30           default, minimal       Practical Extraction and Report Language     

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
```

Actual results:
"dnf module install perl:5.28" exits with exit status: 0, outputting a message "No default profiles for module perl:5.28", and enabling the 5.28 stream.

Expected results:
"dnf module install perl:5.28" exits with exit status non-zero, outputting a error message and not enabling the 5.28 stream.


Additional info:
Below project might be useful to see the issue, when forking the repository and run Travis CI modifying a code for your forked repository.
https://github.com/junaruga/switch-module-stream

Comment 1 Jaroslav Mracek 2019-09-27 12:23:51 UTC
The issue is fixed in dnf-0:4.2.8-2.fc30.noarch

Error is as follows:
No default profiles for module postgresql:11. Available profiles: client, server
Error: Problems in request:
missing groups or modules: postgresql:11

Comment 2 Jun Aruga 2019-09-27 14:38:04 UTC
Thanks for checking!
I checked the error handling is implemented for the dnf in fedora:rawhide container like this.

```
$ podman run --rm -it fedora:rawhide bash

[root@4723a7db9a65 /]# rpm -q dnf
dnf-4.2.9-2.fc32.noarch

[root@4723a7db9a65 /]# dnf module list postgresql
Fedora - Modular Rawhide - Developmental packages for the nex 1.1 MB/s | 2.6 MB     00:02    
Fedora - Rawhide - Developmental packages for the next Fedora 2.0 MB/s |  61 MB     00:30    
Last metadata expiration check: 0:00:01 ago on Fri Sep 27 14:32:37 2019.
Fedora - Modular Rawhide - Developmental packages for the next Fedora release
Name                 Stream          Profiles                       Summary                   
postgresql           9.6             client, server [d]             PostgreSQL module         
postgresql           10              client, server [d]             PostgreSQL module         
postgresql           11              client, server [d]             PostgreSQL module         
postgresql           12              client, libpq, server          PostgreSQL module         

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

[root@4723a7db9a65 /]# dnf module install postgresql:12
Last metadata expiration check: 0:01:34 ago on Fri Sep 27 14:32:37 2019.
No default profiles for module postgresql:12. Available profiles: client, libpq, server
Error: Problems in request:
missing groups or modules: postgresql:12

[root@4723a7db9a65 /]# echo $?
1
```


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