FAQ
Hello all,

I am having a strange problem matching a hierarchy of nodes like the
following one:

node basenode {
...
}
node /^diaspora(?:-\d+)?$/ inherits basenode {
...
}
node /^diaspora15(?:-\d+)?$/ inherits diaspora {
...
}

When I try to instantiate a node that should match the last one (for
example diaspora15 or diaspora15-4433) I find that puppet matches that node
but is not able to match the parent node. From my knowledge of regular
expressions (and checking though rubular), diaspora matches my first
regular expression so the inheritance should be complete.

I get the following message:

Could not find parent resource type 'diaspora' of type node in production
at /tmp/vagrant-puppet/manifests/diaspora.pp:14 on node diaspora15.scytl.net

Also, when I instantiate a node named diaspora that works..

Any idea of what I am doing wrong? I think that puppet allows that kind of
matching.

--
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/-/UV7hjMfzBAAJ.
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

  • Jcbollinger at May 10, 2012 at 10:15 pm

    On May 10, 12:54 pm, David Campos wrote:
    Hello all,

    I am having a strange problem matching a hierarchy of nodes like the
    following one:

    node basenode  {
    ...
    }
    node /^diaspora(?:-\d+)?$/ inherits basenode {
    ...
    }
    node /^diaspora15(?:-\d+)?$/ inherits diaspora {
    ...
    }
    When I try to instantiate a node that should match the last one (for
    example diaspora15 or diaspora15-4433) I find that puppet matches that node
    but is not able to match the parent node. From my knowledge of regular
    expressions (and checking though rubular), diaspora matches my first
    regular expression so the inheritance should be complete.

    I get the following message:

    Could not find parent resource type 'diaspora' of type node in production
    at /tmp/vagrant-puppet/manifests/diaspora.pp:14 on node diaspora15.scytl.net
    Also, when I instantiate a node named diaspora that works..

    Any idea of what I am doing wrong? I think that puppet allows that kind of
    matching.

    Evidently, you are mistaken. Puppet is not matching the parent node
    name against your regex nodes; instead it is looking for a node
    definition bearing exactly that name. Frankly, I don't find that
    surprising.

    You should be able to resolve the problem with a slight juggling of
    your node definitions:

    node basenode {
    ...
    }

    node diaspora inherits basenode {
    ...
    }

    node /^diaspora-\d+$/ inherits diaspora {
    # empty
    }

    node /^diaspora15(?:-\d+)?$/ inherits diaspora {
    ...
    }


    There are other variations and altogether different approaches, too,
    but that's probably the closest to what you already have.


    John

    --
    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.
  • David Campos at May 11, 2012 at 12:56 pm
    Thanks, it was the solution that I tried after posting this. I had seen in
    a puppet bug something about regex matchers at either side of the inherits
    expression and thought that it could be possible.

    I had not thought about doing the double definition, the textual one and
    the regex. Thanks for pointing it out.
    On Friday, May 11, 2012 12:15:07 AM UTC+2, jcbollinger wrote:


    On May 10, 12:54 pm, David Campos wrote:
    Hello all,

    I am having a strange problem matching a hierarchy of nodes like the
    following one:

    node basenode {
    ...
    }
    node /^diaspora(?:-\d+)?$/ inherits basenode {
    ...
    }
    node /^diaspora15(?:-\d+)?$/ inherits diaspora {
    ...
    }
    When I try to instantiate a node that should match the last one (for
    example diaspora15 or diaspora15-4433) I find that puppet matches that node
    but is not able to match the parent node. From my knowledge of regular
    expressions (and checking though rubular), diaspora matches my first
    regular expression so the inheritance should be complete.

    I get the following message:

    Could not find parent resource type 'diaspora' of type node in
    production
    at /tmp/vagrant-puppet/manifests/diaspora.pp:14 on node
    diaspora15.scytl.net
    Also, when I instantiate a node named diaspora that works..

    Any idea of what I am doing wrong? I think that puppet allows that kind of
    matching.

    Evidently, you are mistaken. Puppet is not matching the parent node
    name against your regex nodes; instead it is looking for a node
    definition bearing exactly that name. Frankly, I don't find that
    surprising.

    You should be able to resolve the problem with a slight juggling of
    your node definitions:

    node basenode {
    ...
    }

    node diaspora inherits basenode {
    ...
    }

    node /^diaspora-\d+$/ inherits diaspora {
    # empty
    }

    node /^diaspora15(?:-\d+)?$/ inherits diaspora {
    ...
    }


    There are other variations and altogether different approaches, too,
    but that's probably the closest to what you already have.


    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/-/ri6S-ITAoosJ.
    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
postedMay 10, '12 at 5:54p
activeMay 11, '12 at 12:56p
posts3
users2
websitepuppetlabs.com

2 users in discussion

David Campos: 2 posts Jcbollinger: 1 post

People

Translate

site design / logo © 2022 Grokbase