Skip to content

(#12269) multiple cycles in graph fail on sort#425

Merged
grimradical merged 6 commits intopuppetlabs:2.7.xfrom
slippycheeze:bug/2.7.x/12269-multiple-cycles-in-graph-fail-on-sort
Feb 1, 2012
Merged

(#12269) multiple cycles in graph fail on sort#425
grimradical merged 6 commits intopuppetlabs:2.7.xfrom
slippycheeze:bug/2.7.x/12269-multiple-cycles-in-graph-fail-on-sort

Conversation

@slippycheeze
Copy link
Copy Markdown
Contributor

This fixes up code that handled the randomized hash ordering in Ruby 1.8.7 after a CVE fix:

At the time I felt it was safer to avoid changes to core classes, and instead to use an externally generated key for sorting. This turned out not to be the case - as so often the "safe" choice turns out t be worse that the "right" fix would have been.

This redresses that by extending the core Puppet::Type and Puppet::Provider classes to support ordering (against other instances of the same class, or subclasses), and then uses that everywhere that we need to express a natural ordering over sets of the same type.

It also adds an acceptance test, moves away from fake input data to tests, and generally improves our chances of detecting a similar problem next time through.

Daniel Pittman added 6 commits January 29, 2012 15:20
We have found a couple of places where the behaviour of the items tested, and
the behaviour of the real system, differ - because the tests were run over
simpler objects than the real Puppet::Type instances we work on in the field.

This moves from testing on fake things to testing on the real deal, which
gives us a much more solid basis to trust the tests.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Type instances have a reasonable natural order, which allows us to make them
Comparable.  This, in turn, makes any interaction where ordering is of
interest easier to deal with.

This implementation uses the string form of the resource as the basis for
comparison, which is a reasonable starting point from existing definitions of
ordering over resource instances.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
This eliminates the proxy sorting in the graph library, which was working
around the fact that Puppet::Type was not able to be ordered out of the box.

That makes the whole process significantly more robust.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Like types, our providers have a natural internal order.  Exposing that allows
us to eliminate proxy sorting everywhere that it is done, and have more
uniform treatment of our types.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
The module tool used to generate and sort by a proxy key for providers, when
detailing their content.  Instead, this can use the natural ordering of
providers previously introduced.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
This adds a simple acceptance test that validates we detect and report cycles
in a catalog as we compile and try to execute it.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
grimradical added a commit that referenced this pull request Feb 1, 2012
…cycles-in-graph-fail-on-sort

(#12269) multiple cycles in graph fail on sort
@grimradical grimradical merged commit b7e1c32 into puppetlabs:2.7.x Feb 1, 2012
melissa pushed a commit to melissa/puppet that referenced this pull request Mar 30, 2018
(maint) Remove unused include from pxp_schemas.cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants