diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-20 15:51:39 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-21 12:37:26 -0700 |
commit | f17f6bba87519db888854acf7017ddff61f635be (patch) | |
tree | dc092056e59e018bb6e56f1c4918685220d21ad9 /spec/lib | |
parent | 7414ee7ebda1052f4c52f3e5565726f20de5a20b (diff) | |
download | puppet-f17f6bba87519db888854acf7017ddff61f635be.tar.gz puppet-f17f6bba87519db888854acf7017ddff61f635be.tar.xz puppet-f17f6bba87519db888854acf7017ddff61f635be.zip |
(#7183) Implement "invisible glob" version matching for faces
"Invisible glob", or "prefix", version matching means that when you specify a
version string to use you can specify as little as one version number out of
the semantic versioning spec.
Matching is done on the prefix; an omitted number is treated as "anything" in
that slot, and we return the highest matching versioned face by that spec.
For example, given the set of versions: 1.0.0, 1.0.1, 1.1.0, 1.1.1, 2.0.0
The following would be matched:
input matched
1 1.1.1
1.0 1.0.1
1.0.1 1.0.1
1.0.2 fail - no match
1.1 1.1.1
1.1.1 1.1.1
1.2 fail - no match
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/puppet/face/version_matching.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/lib/puppet/face/version_matching.rb b/spec/lib/puppet/face/version_matching.rb new file mode 100644 index 000000000..bfd0013f7 --- /dev/null +++ b/spec/lib/puppet/face/version_matching.rb @@ -0,0 +1,10 @@ +require 'puppet/face' + +# The set of versions here are used explicitly in the interface_spec; if you +# change this you need to ensure that is still correct. --daniel 2011-04-21 +['1.0.0', '1.0.1', '1.1.0', '1.1.1', '2.0.0'].each do |version| + Puppet::Face.define(:version_matching, version) do + summary "version matching face #{version}" + script :version do version end + end +end |