puppetlabs / puppetlabs-apt

Puppet module to help manage Apt
https://forge.puppetlabs.com/puppetlabs/apt
Apache License 2.0
215 stars 463 forks source link

Issue Adding Repo With Uncommon Formatting #1031

Closed jamboNum5 closed 2 years ago

jamboNum5 commented 2 years ago

Describe the Bug

I was recently trying to add a repo for r project, the formatting seems a little different from normal source list files. It was essential for the list file to be formatted as below or it wouldn't allow apt update to run.

deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/

This repo allows the more up to date version of r to be installed. More info : https://cran.r-project.org/bin/linux/ubuntu/fullREADME.html

Expected Behavior

I was struggling to get the line formatting correct using the manifest script, I tried a few combinations setting bionic-cran40/ as the release and repo as ' ' but this resulted in a formatting failure when the agent checked in. If I left out repo completely, the list file came out as the following:

deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ main

I had to resort to a file directive which isn't the end of the world, just interested to know what I could have done better here.

Environment

centos 7 puppet master ubuntu 20.04 / 18.04

kenyon commented 2 years ago

Works for me like this in hiera:

apt::sources:
  r:
    location: https://cloud.r-project.org/bin/linux/ubuntu
    release: ''
    repos: jammy-cran40/
kenyon@lithium ~ % cat /etc/apt/sources.list.d/r.list           
# This file is managed by Puppet. DO NOT EDIT.
# r
deb https://cloud.r-project.org/bin/linux/ubuntu  jammy-cran40/
jamboNum5 commented 2 years ago

Hi Kenyon

I had initially configured this apt info hard coded from within a site.pp file. I haven't used Hiera to any extent but have been checking some videos since you mentioned it the other day.

Thanks for the help James

kenyon commented 2 years ago

It doesn't have to be in hiera, that was just an example. The equivalent puppet code:

apt::source { 'r':
  location => 'https://cloud.r-project.org/bin/linux/ubuntu',
  release  => '',
  repos    => 'jammy-cran40/',
}
jamboNum5 commented 2 years ago

I'm very confused now as I was certain sure that I had tried that combination of release/repo. I have just done this again it appears to be working fine, before I was getting some sort of validation message previous which I thought it was down to the forward slash.

Thanks again all sorted!

david22swan commented 2 years ago

@jamboNum5 Hey, look's like your all sorted so just gonna close this out.

@kenyon Thanks for being an excellent community member.