Hi,

you are probably right. Here we go:

as I am using puppet apply, I have in my site.pp:

include role::fips_tool

in fips_tool there is, among other code:

...
class { profile::software::apache:
    php_version         => '7.3',
    default_redirect_to => 'http://my.host.name',
    maindir             => '/srv/labor/',
    keep_log_days       => 30,
  }

  class { profile::software::wordpress:
    php_version => '7.3',
  }
...

The offending code from profile::software::apache:

class profile::software::apache (
  String $php_version         = '7.0',
  String $default_redirect_to = 'https://my.host.name',
  String $maindir             = '/srv/www/',
  Integer $keep_log_days      = 30,
) {

...

ensure_packages([
    "php$php_version-xml",
    "php$php_version-zip",
    "php$php_version-curl",
    "php$php_version-mbstring",
    "libapache2-mod-php$php_version",

  ],
    {
      require => [Class['apt::update'], Apt::Source['sury_php'], ]
    }
  )

...}

and from profile::software::wordpress.pp:

class profile::software::wordpress (
    String $php_version = '7.0',
){
  require profile::software::mysql
  require profile::software::apache

...

ensure_packages([
    'php7.1-mysql',
    'php7.1-common',
    "libapache2-mod-php$php_version",
    "php$php_version-gd",
    "php$php_version-mysql",
  ],
    {
      require     => [Class['apt::update'], Apt::Source['sury_php']],
      notify      => Class['apache::service']
    })

...
}

On the dev Vagrant machine, I run this calling:

sudo puppet apply /etc/puppetlabs/code/environments/dev/manifests/

Code runs without a problem:

Notice: Scope(Class[Profile::Software::Tool_packages]): VirtualBox
Warning: You cannot collect exported resources without storeconfigs being 
set; the export is ignored (file: 
/etc/puppetlabs/code/environments/dev/modules-external/ssh/manifests/hostkeys.pp,
 
line: 39, column: 7)
Warning: You cannot collect exported resources without storeconfigs being 
set; the export is ignored (file: 
/etc/puppetlabs/code/environments/dev/modules-external/ssh/manifests/hostkeys.pp,
 
line: 32, column: 7)
Warning: You cannot collect exported resources without storeconfigs being 
set; the export is ignored (file: 
/etc/puppetlabs/code/environments/dev/modules-external/ssh/manifests/hostkeys.pp,
 
line: 32, column: 7)
Warning: You cannot collect exported resources without storeconfigs being 
set; the export is ignored (file: 
/etc/puppetlabs/code/environments/dev/modules-external/ssh/manifests/hostkeys.pp,
 
line: 32, column: 7)
Warning: You cannot collect exported resources without storeconfigs being 
set; the collection will be ignored (file: 
/etc/puppetlabs/code/environments/dev/modules-external/ssh/manifests/knownhosts.pp,
 
line: 9, column: 7)
Notice: Scope(Class[Profile::Software::Certbot]): setting Let's encrypt 
staging environment!!!
Warning: Scope(Class[Apache::Mod::Status]): Class apache::mod::status: 
Using Allow
Warning: Scope(Class[Apache::Mod::Status]): is deprecated in Apache 2.4
Notice: Scope(Class[Java_ng]): Selected repository: ppa:oracle, selected 
version: 8
Notice: Compiled catalog for stretch.localdomain in environment dev in 5.74 
seconds
Notice: Applied catalog in 3.20 seconds

On the live VM I checkout the exakt same code from GIT, running it with:

puppet apply /etc/puppetlabs/code/environments/production/manifests/

but the output is:

Warning: You cannot collect exported resources without storeconfigs being 
set; the export is ignored (file: 
/etc/puppetlabs/code/environments/production/modules-external/ssh/manifests/hostkeys.pp,
 
line: 39, column: 7)
Warning: You cannot collect exported resources without storeconfigs being 
set; the export is ignored (file: 
/etc/puppetlabs/code/environments/production/modules-external/ssh/manifests/hostkeys.pp,
 
line: 32, column: 7)
Warning: You cannot collect exported resources without storeconfigs being 
set; the export is ignored (file: 
/etc/puppetlabs/code/environments/production/modules-external/ssh/manifests/hostkeys.pp,
 
line: 32, column: 7)
Warning: You cannot collect exported resources without storeconfigs being 
set; the export is ignored (file: 
/etc/puppetlabs/code/environments/production/modules-external/ssh/manifests/hostkeys.pp,
 
line: 32, column: 7)
Warning: You cannot collect exported resources without storeconfigs being 
set; the collection will be ignored (file: 
/etc/puppetlabs/code/environments/production/modules-external/ssh/manifests/knownhosts.pp,
 
line: 9, column: 7)
Error: Evaluation Error: Error while evaluating a Function Call, Duplicate 
declaration: Package[libapache2-mod-php7.3] is already declared at (file: 
/etc/puppetlabs/code/environments/production/modules/profile/manifests/software/apache.pp,
 
line: 78); cannot redeclare (file: 
/etc/puppetlabs/code/environments/production/modules/profile/manifests/software/wordpress.pp,
 
line: 24) (file: 
/etc/puppetlabs/code/environments/production/modules/profile/manifests/software/wordpress.pp,
 
line: 24, column: 3) on node my.host.name

I recreated my Vagrant machine, works like a charm. Both machines run 
Puppet 6.2.0 on Debian 9.7

Sorry for the extensive post, this is because I do not have any clue where 
to look.

Thanks, regards

Jochen


Am Mittwoch, 30. Januar 2019 22:40:26 UTC+1 schrieb Ben Ford:
>
> Sharing the code that you're working with will make it possible for people 
> to help solve your problem.
>
> On Wed, Jan 30, 2019 at 10:22 AM Jochen Haeberle <[email protected] 
> <javascript:>> wrote:
>
>> Hi @all,
>>
>> does anyone have an idea what could be happening? I think this might be 
>> some sort of configuration error on the node, on the other hand, puppet 
>> obviously seems able to compile a catalog.
>> What could be the reason for such a difference in behaviour on Debian 9.7 
>> either on Vagrant or VMware?
>>
>> Thanks for any hints, regards
>>
>> Jochen
>>
>> Am Dienstag, 29. Januar 2019 00:02:42 UTC+1 schrieb Jochen Haeberle:
>>>
>>> Hi, 
>>>
>>> I am using serverless puppet apply on some nodes. I prepared a set of 
>>> manifests using forge plugins. I developed everything using Vagrant quite 
>>> fine. 
>>>
>>> Now I put my code via git on a debian 9.7 VM with puppet 6.2 and am 
>>> getting the following errors: 
>>>
>>> Error: Evaluation Error: Error while evaluating a Function Call, 
>>> Duplicate declaration: Package[libapache2-mod-php7.3] is already declared 
>>> at (file: 
>>> /etc/puppetlabs/code/environments/production/modules/profile/manifests/software/apache.pp,
>>>  
>>> line: 78); cannot redeclare (file: 
>>> /etc/puppetlabs/code/environments/production/modules/profile/manifests/software/wordpress.pp,
>>>  
>>> line: 24) (file: 
>>> /etc/puppetlabs/code/environments/production/modules/profile/manifests/software/wordpress.pp,
>>>  
>>> line: 24, column: 3) 
>>>
>>> Both instances use the stdlib function ensure_packages. If I remove one 
>>> of the instances, I will get the error with another package. 
>>>
>>> puppetlabs/stdlib and all other modules are up to date, thanks to r10k, 
>>> Code is working on a fresh vagrant machine. 
>>>
>>> What can be the culprit of this? I have no idea where to look for this 
>>> problem. 
>>>
>>> Thanks in advance vor any hints, regards 
>>>
>>> Jochen
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/4e0cd8c4-577f-42a6-a664-e6f4015fca5d%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/puppet-users/4e0cd8c4-577f-42a6-a664-e6f4015fca5d%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d79b17e4-9eb8-455b-89a1-afdf86f743b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to