voxpupuli / puppet-yum

Puppet module for Yum
https://forge.puppet.com/puppet/yum
MIT License
16 stars 101 forks source link

gpgkey cannot specify more than one of content, source #204

Closed patemery closed 3 years ago

patemery commented 3 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

puppet apply --modulepath /home/pat/modules -e 'class { "yum": manage_os_default_repos => false, }'

with the following added locally into the "yum" module. I understand that that is not the right way to do it. I only did it to create the smallest test case I could with the least amount of work.

I added the following to yum/data/common.yaml

yum::gpgkeys:
  /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7:
    source: puppet:///modules/yum/RPM-GPG-KEY-EPEL-7
yum::managed_repos:
  - 'local_epel'
yum::repos:
  local_epel:
    ensure: 'present'
    descr: 'EPEL for RHEL7'
    baseurl: 'http://reposerver.vanguard.com/epel7/'
    enabled: true
    gpgcheck: true
    gpgkey: 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7'

I created a "files" dir in "yum" module and I added the gpg key file from EPEL to yum/files directory

What are you seeing

Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, You cannot specify more than one of content, source (file: /export/home/nt018238/puppet/dev/modules/yum/manifests/gpgkey.pp, line: 50, column: 18) (file: /export/home/nt018238/puppet/dev/modules/yum/manifests/init.pp, line: 140) on node xyz.vanguard.com

What behaviour did you expect instead

I expected

  1. the file /etc/yum.repos.d/local_epel.repo to be created with content enabling gpg key and pointing to file in /etc/pki/rpm-gpg
  2. the file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 to be created from files dir within module
  3. rpm --import to run for the file created in /etc/pki/rpm-gpg

Output log

See "What are you seeing above"

Any additional information you'd like to impart

I feel as though I have crafted my yaml correctly to accomplish my goal following the examples in the README. What have I done wrong to cause this compilation/evaluation error?

Sorry if I am using the "issue tracker" here inappropriately. Wasn't sure if this was an acceptable use

First time posting an "issue" on github. I wanted to assign the "question" label to this "issue". I can't seem to do that. Are labels only applied by the project owners?

patemery commented 3 years ago

I figured out what I was doing wrong. Because /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-* exists in the module data, the merge of my hieradata, which specified "source", was duplicating data provided by the module data causing the error. I simply needed to remove the "source" line from my hieradata. Sorry for wasting anyone's time with this question/issue