Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[master] Do not break repo files with multiple line values on "yumpkg" #55584

Conversation

meaksh
Copy link
Contributor

@meaksh meaksh commented Dec 10, 2019

This PR ports #53293 to master branch, and fixes an issue at 2019.2.x release.


What does this PR do?

This PR fixes an issue happening when running either pkg.mod_repo and pkg.del_repo from the yumpkg module when a repo file has multiline values.

Given this repo file as example in /etc/yum.repos.d/salt-products-testing.repo:

[systemsmanagement_saltstack_products_testing]
name=Salt releases for SLE-based SUSE products testing (RHEL_7)
failovermethod=priority
gpgkey=http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/repodata/repomd.xml.key
enabled=1
baseurl=http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/
 http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/
gpgcheck=1
type=rpm-md

Previous Behavior

$ salt-call --local pkg.mod_repo systemsmanagement_saltstack_products_testing
local:
    ----------
    /etc/yum.repos.d/salt-products-testing.repo:
        ----------
        systemsmanagement_saltstack_products_testing:
            ----------
            baseurl:
                http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/
                http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/
            enabled:
                1
            failovermethod:
                priority
            gpgcheck:
                1
            gpgkey:
                http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/repodata/repomd.xml.key
            name:
                Salt releases for SLE-based SUSE products testing (RHEL_7)
            type:
                rpm-md

After that, the file is already broken. Notice there is no multiline value anymore and instead there is a buggy http attribute:

$ cat /etc/yum.repos.d/salt-products-testing.repo
[systemsmanagement_saltstack_products_testing]
http=//download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/
name=Salt releases for SLE-based SUSE products testing (RHEL_7)
failovermethod=priority
gpgkey=http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/repodata/repomd.xml.key
enabled=1
baseurl=http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/
gpgcheck=1
type=rpm-md

New Behavior

The repo file preserves the multiline values:

$ cat /etc/yum.repos.d/salt-products-testing.repo
[systemsmanagement_saltstack_products_testing]
name=Salt releases for SLE-based SUSE products testing (RHEL_7)
failovermethod=priority
gpgkey=http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/repodata/repomd.xml.key
enabled=1
baseurl=http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/
 http://download.opensuse.org/repositories/systemsmanagement:/saltstack:/products:/testing/RHEL_7/
gpgcheck=1
type=rpm-md

Tests written?

Yes

Commits signed with GPG?

Yes

@dwoz dwoz merged commit af66236 into saltstack:master Jan 14, 2020
@meaksh meaksh deleted the master-yumpkg-do-not-break-repo-files-with-multiline-values branch January 15, 2020 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants