FAQ
Hi all,

I'm developing my own module, and i want to declare same resources in
different class like this :

This resource is used to configure my Jboss server by copying conf files in
/myappbase/applis/conf
class srhjboss::config::applis {

file { "/myappbase/applis/conf":

ensure => directory,
notify => Class['srhjboss::service'],
recurse => true,
source => 'puppet:///modules/srhjboss/communs',

}

}

The second class and resource is used to deploy the conf file of my war
application like this :

class srhdeployit::war {

file { "/myappbase/applis/conf"':
ensure => present,
source => "puppet://puppet/srnrepo/myappname",
recurse => true,
}

}

then i include the class in the node

node default {
include srhjboss::config::applis
include srhdeployit::war

I got the exact failure :

err: Failed to apply catalog: Cannot alias File[ ' ' ] to
["/sirhen/applis/conf"] at
/etc/puppet/modules/srhjboss/manifests/config/applis.pp:47; resource
["File", "/sirhen/applis/conf"] already declared at
/etc/puppet/modules/srhdeployit/manifests/war.pp:44

Do you have suggestions on how to do it?

Thanks

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/70voc_9UPecJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Christopher Wood at Aug 16, 2012 at 3:50 pm
    Short version: use a define.

    http://docs.puppetlabs.com/guides/language_guide.html#defined-resource-types


    But did you mean to have unbalanced quotes here? There's an extra single quote.

    file { "/myappbase/applis/conf"':


    Regardless of whether you use a define or a class, you can't define the same file resource twice.

    In the first resource, this:

    /myappbase/applis/conf

    Will end up with the contents of:

    puppet:///modules/srhjboss/communs

    And in the second one, it will end up with these contents:

    puppet://puppet/srnrepo/myappname

    You'll have to pick one per node.

    On Thu, Aug 16, 2012 at 08:41:12AM -0700, Rost wrote:
    Hi all,
    I'm developing  my own module, and i want to declare same resources in
    different class like this :
    This resource is used to configure my Jboss server by copying conf files
    in /myappbase/applis/conf
    class srhjboss::config::applis {

    file { "/myappbase/applis/conf":

    ensure => directory,
    notify => Class['srhjboss::service'],
    recurse => true,
    source => 'puppet:///modules/srhjboss/communs',

    }

    }
    The second class and resource is used to deploy the conf file of my war
    application like this :
    class srhdeployit::war {

    file { "/myappbase/applis/conf"':
    ensure => present,
    source => "puppet://puppet/srnrepo/myappname",
    recurse => true,
    }

    }
    then i include the class in the node
    node default {
    include srhjboss::config::applis
    include srhdeployit::war
    I got the exact failure :
    err: Failed to apply catalog: Cannot alias File[ ' ' ] to
    ["/sirhen/applis/conf"] at
    /etc/puppet/modules/srhjboss/manifests/config/applis.pp:47; resource
    ["File", "/sirhen/applis/conf"] already declared at
    /etc/puppet/modules/srhdeployit/manifests/war.pp:44
    Do you have suggestions on how to do it?
    Thanks

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    [1]https://groups.google.com/d/msg/puppet-users/-/70voc_9UPecJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.

    References

    Visible links
    1. https://groups.google.com/d/msg/puppet-users/-/70voc_9UPecJ
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Rost at Aug 16, 2012 at 4:00 pm
    Yes I want to fill /myappbase/applis/conf with the content of twice
    sources, but in different class.



    Le jeudi 16 août 2012 17:41:12 UTC+2, Rost a écrit :
    Hi all,

    I'm developing my own module, and i want to declare same resources in
    different class like this :

    This resource is used to configure my Jboss server by copying conf files
    in /myappbase/applis/conf
    class srhjboss::config::applis {

    file { "/myappbase/applis/conf":

    ensure => directory,
    notify => Class['srhjboss::service'],
    recurse => true,
    source => 'puppet:///modules/srhjboss/communs',

    }

    }

    The second class and resource is used to deploy the conf file of my war
    application like this :

    class srhdeployit::war {

    file { "/myappbase/applis/conf"':
    ensure => present,
    source => "puppet://puppet/srnrepo/myappname",
    recurse => true,
    }

    }

    then i include the class in the node

    node default {
    include srhjboss::config::applis
    include srhdeployit::war

    I got the exact failure :

    err: Failed to apply catalog: Cannot alias File[ ' ' ] to
    ["/sirhen/applis/conf"] at
    /etc/puppet/modules/srhjboss/manifests/config/applis.pp:47; resource
    ["File", "/sirhen/applis/conf"] already declared at
    /etc/puppet/modules/srhdeployit/manifests/war.pp:44

    Do you have suggestions on how to do it?

    Thanks
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/aHhdmLUA6hUJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jcbollinger at Aug 17, 2012 at 1:29 pm

    On Thursday, August 16, 2012 11:00:34 AM UTC-5, Rost wrote:
    Yes I want to fill /myappbase/applis/conf with the content of twice
    sources, but in different class.



    Le jeudi 16 août 2012 17:41:12 UTC+2, Rost a écrit :
    Hi all,

    I'm developing my own module, and i want to declare same resources in
    different class like this :

    This resource is used to configure my Jboss server by copying conf files
    in /myappbase/applis/conf
    class srhjboss::config::applis {

    file { "/myappbase/applis/conf":

    ensure => directory,
    notify => Class['srhjboss::service'],
    recurse => true,
    source => 'puppet:///modules/srhjboss/communs',

    }

    }

    The second class and resource is used to deploy the conf file of my war
    application like this :

    class srhdeployit::war {

    file { "/myappbase/applis/conf"':
    ensure => present,
    source => "puppet://puppet/srnrepo/myappname",
    recurse => true,
    }

    }

    then i include the class in the node

    node default {
    include srhjboss::config::applis
    include srhdeployit::war

    I got the exact failure :

    err: Failed to apply catalog: Cannot alias File[ ' ' ] to
    ["/sirhen/applis/conf"] at
    /etc/puppet/modules/srhjboss/manifests/config/applis.pp:47; resource
    ["File", "/sirhen/applis/conf"] already declared at
    /etc/puppet/modules/srhdeployit/manifests/war.pp:44
    As Christopher explained, you cannot declare the same resource twice on the
    same node, as it is internally inconsistent. You give Puppet conflicting
    information about the properties of the resource, so which is it supposed
    to apply?

    Supposing that none of the files provided by class 'srhdeployit::war'
    replace files provided by class 'srhjboss::config::applis', you should be
    able to solve the problem by using separate File resources for each file or
    directory that the former wants to manage. Note also that it looks like
    you probably need a 'requires' parameter on the 'srhdeployit::war' file(s).


    John

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/wsfaj8SLod8J.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedAug 16, '12 at 3:41p
activeAug 17, '12 at 1:29p
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase