Bug #2813

Aliases can no longer be used as resource names in references?

Added by Tim Stoop about 2 years ago. Updated almost 2 years ago.

Status:Closed Start date:11/13/2009
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:RAL
Target version:0.25.2
Affected Puppet version:0.25.1 Branch:http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/2813
Keywords:
Votes: 1

Description

Hi there,

I have a very simple (part of a) manifest:

host { "nfs":
  alias => "nfs.ip",
  ip => "10.2.0.10",
}

nfs_mount { "/srv/oracle":
  source => "nfs.ip:/path/to/mount",
  require => Host["nfs.ip"],
}

This gives me the error:

err: Could not apply complete catalog: Could not retrieve dependency 'Host[nfs.ip]' of Nfs_mount[/srv/oracle] at manifestfile:123

This worked in 0.24.8. Actually, when I revert to the 0.24.8 client but keep the puppetmaster at 0.25.1, it still works. Only after upgrading the client to 0.25.1 it breaks.

Please let me know if there’s anything I can do to help fix this.

History

Updated by Tim Stoop about 2 years ago

This is a complete class that will fail, for (hopefully) easy testing. Keep in mind that it doesn’t clean up!

class bug2813 {
    host { "bug2813":
        alias => "bug2813.test",
        ip    => "127.1.0.1",
    }

    file { "/tmp/bug2813":
        alias   => "bug2813",
        content => "fubar",
        require => Host["bug2813.test"],
    }
}

Updated by Luke Kanies about 2 years ago

  • Category set to RAL
  • Status changed from Unreviewed to Accepted
  • Target version set to 0.25.2

Updated by Brice Figureau about 2 years ago

Tim Stoop wrote:

This is a complete class that will fail, for (hopefully) easy testing. Keep in mind that it doesn’t clean up!

[…]

I couldn’t reproduce this bug with latest 0.25.x HEAD.

Updated by Tim Stoop about 2 years ago

Brice Figureau wrote:

I couldn’t reproduce this bug with latest 0.25.x HEAD.

Any chance there’s an easy way to see which patch in HEAD since 0.25.1 solved it? I don’t mind cherry-picking patches, but I rather not run an entirely unreleased version.

Updated by Markus Roberts about 2 years ago

I don’t think it’s been solved. Putting:

class bug2813 {
    host { "bug2813":
        alias => "bug2813.test",
        ip    => "127.1.0.1",
    }
    file { "/tmp/bug2813":
        alias   => "bug2813",
        content => "fubar",
        require => Host["bug2813.test"],
    }
}
node default {
    include bug2813
} 

in 2813.pp and running:

puppet 2813.pp

on the latest 0.25.x I got:

Could not find dependency Host[bug2813.test] for File[/tmp/bug2813] at /Users/markus/projects/puppet/2813.pp:11

Putting a finer point on it, changing 2813.pp to:

node default {
    host { "x": alias => "xyz"}
    host { "y": require => Host["xyz"] }
}

gives me:

Could not find dependency Host[xyz] for Host[y] at /Users/markus/projects/puppet/2813.pp:3

Updated by Brice Figureau about 2 years ago

Brice Figureau wrote:

Tim Stoop wrote:

This is a complete class that will fail, for (hopefully) easy testing. Keep in mind that it doesn’t clean up!

[…]

I couldn’t reproduce this bug with latest 0.25.x HEAD.

Note I tested without a node, directly including the class and/or its content. But that shouldn’t really matter. Note, I tested with files and not host (because I don’t run as root, so modifying /etc/hosts was not an option).

/me thinking hard

I think the issue is that Host has an “alias” property: http://reductivelabs.com/trac/puppet/wiki/TypeReference#id436 which certainly overrides the alias metaparameter.

Is it working in 0.24.8?

Updated by Markus Roberts about 2 years ago

  • Status changed from Accepted to Needs Decision

Bingo. I just confirmed.

I’m changing this to “Needs design decision” but it should probably go to “Rejected” or to the documentation category unless somebody wants to fight for it being a bug.

Updated by Tim Stoop about 2 years ago

Well, this worked in 0.24.8 and it seems logical to have it work that way. I’m not pressing it, though, I can easily change my code. Just seems a little bit inconsistent.

Updated by Luke Kanies about 2 years ago

  • Status changed from Needs Decision to Accepted

Definitely a bug.

Updated by Markus Roberts about 2 years ago

Does the code/process I posted above work for you under 0.24.8?

When I try it I get exactly the same results as under the current 0.25.x. Attempting to bisect it I’m seeing the present behavior back to commit:c370104f7efa6231af05df17ccbb03cbaa2e48ab; prior to that it objects to any alias.

Updated by Tim Stoop about 2 years ago

Ah just noticed we ran 0.24.8rc1 for a long time. But it worked in there. I only noticed it after switching to 0.25.1.

Updated by Markus Roberts about 2 years ago

  • Status changed from Accepted to Needs More Information

It’s not clear to me that this is a sound idea. I’ve posed the question to the dev-list.

Updated by Markus Roberts about 2 years ago

  • Status changed from Needs More Information to Accepted
  • Assignee set to Markus Roberts

The consensus seems to be that the parameters should be renamed. I’m going to propose “host_alias” as a starting suggestion.

Updated by Markus Roberts about 2 years ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Branch set to http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/2813

Branch up which renames the alias parameter to host_aliases.

http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/2813

Updated by Markus Roberts about 2 years ago

  • Assignee deleted (Markus Roberts)

Updated by James Turnbull about 2 years ago

  • Status changed from In Topic Branch Pending Review to Closed

Pushed in commit:854c06502d1a8f6d6dfaf0abeaacb4791a6fb5ed in branch 0.25.x

Updated by Peter Couvares about 2 years ago

Do I understand correctly that this change breaks backwards compatibility between 0.25.x puppetmasters and 0.24.x clients (if any host aliases are defined), because the old “alias” metaparameter will be ignored by the puppetmaster, and the new “host_aliases” metaparameter will produce errors in the clients?

Updated by Luke Kanies about 2 years ago

Peter Couvares wrote:

Do I understand correctly that this change breaks backwards compatibility between 0.25.x puppetmasters and 0.24.x clients (if any host aliases are defined), because the old “alias” metaparameter will be ignored by the puppetmaster, and the new “host_aliases” metaparameter will produce errors in the clients?

Hmm. You appear to be correct – we’ve changed the semantics in a non-backward-compatible way. The only way around it, at this point, is to selectively set the alias for older clients and host_alias for new clients. Yuck.

Anyone have any ideas?

Also available in: Atom PDF