On Mon, Mar 21, 2011 at 03:42:33PM -0700, Jacob Helwig wrote: > On Fri, 24 Dec 2010 01:04:12 +0100, Stefan Schulte wrote: > > > > I talked about a resourcetype for /etc/services on the list and a > > resourcetype with name and protoco as a composite key seems be be the > > best way to implement it. This patch requires: > > > > #5605 > > #5661 > > #5662 > > > > I have no idea if this works on Mac OS X because I just tested it with a > > standard linux /etc/services. > > > > Stefan, > > I started taking a look at the patch series, but it doesn't look like > the tests run at all. I get an error about trying to use > pupepttest/support/utils > > > /home/jhelwig/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `gem_original_require': no such file to load -- puppettest/support/utils > (LoadError) > from > /home/jhelwig/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `require' > from /home/jhelwig/work/puppet/spec/unit/provider/port/parsed_spec.rb:6 > from > /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in > `load' > from > /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in > `load_spec_files' > from > /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in > `map' > from > /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in > `load_spec_files' > from > /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in > `run' > from > /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in > `run_in_process' > from > /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in > `run' > from > /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in > `autorun' > from /home/jhelwig/.rvm/gems/ruby-1.8.7-p302@rspec2/bin/rspec:19 > > It looks like the new test is the only one attempting to use puppettest > from within the spec test framework. It looks like this will need to > get sorted out before we can merge it in. > > I'm assuming that these tests are running fine for you. Anything I > should be aware of to get them running on my end?
I tried to run the tests but I got rspec failures. I guess it's because
I just have rspec2 installed now and was using rspec1 when I wrote the
tests. After rebasing on current next I got the same error you have.
I will spend some time today to work that one out.
In general the tests may be insufficient because I just did tests on my
private machine. If you have any suggestions about additional test cases
or know of some special behaviour on platform X I'll be happy to improve
the current specs.
>
> As an aside, I started cleaning up some of the grammar, and tweaking
> some of the error messages (diff below).
>
> diff --git i/lib/puppet/type/port.rb w/lib/puppet/type/port.rb
> index e2a4afa..7e04ed5 100755
> --- i/lib/puppet/type/port.rb
> +++ w/lib/puppet/type/port.rb
> @@ -1,16 +1,16 @@
> module Puppet
> newtype(:port) do
> - @doc = "Installs and manages port entries. For most systems, these
> + @doc = "Install and manage port entries. For most systems, these
> entries will just be in /etc/services, but some systems (notably OS X)
> will have different solutions."
>
> def self.title_patterns
> [
> - # we just have one titlepattern "name:protocol"
> + # we just have one title_pattern "name:protocol"
> [
> /^(.*?)(?::(tcp|udp))?$/, # Regex to parse title
> [
> - # We don't need a lot of postparsing
> + # We don't need a lot of post-parsing
> [ :name, lambda{|x| x} ],
> [ :protocol, lambda{ |x| x.intern unless x.nil? } ],
> ]
> @@ -24,20 +24,20 @@ module Puppet
> desc "The port name."
>
> validate do |value|
> - raise Puppet::Error "Portname cannot have whitespaces in them" if
> value =~ /\s/
> + raise Puppet::Error "Port name cannot have whitespaces in it" if
> value =~ /\s/
> end
>
> isnamevar
> end
>
> newparam(:protocol) do
> - desc "The protocols the port uses. Valid values are *udp* and *tcp*.
> + desc "The protocol the port uses. Valid values are *udp* and *tcp*.
> Most services have both protocols, but not all. If you want both
> protocols you have to define two resources. Remeber that you cannot
> specify two resources with the same title but you can use a title
> to set both, name and protocol if you use ':' as a seperator. So
> - port { 'telnet:tcp': ... } sets both name and protocol and you dont
> - have to specify them explicitly then"
> + port { 'telnet:tcp': ... } sets both name and protocol and you don't
> + have to specify them explicitly."
>
> newvalues :tcp, :udp
>
> @@ -46,18 +46,17 @@ module Puppet
> isnamevar
> end
>
> -
> newproperty(:number) do
> desc "The port number."
>
> validate do |value|
> raise Puppet::Error, "number has to be numeric, not #{value}" unless
> value =~ /^[0-9]+$/
> - raise Puppet::Error, "number #{value} out of range" unless
> (0...2**16).include?(Integer(value))
just out of curiosity: Will (0...2**16) generate just a huge array with
include? beeing extreamly slow or does ruby handle ranges of integers
differently?
> + raise Puppet::Error, "number #{value} out of range (0-65535)" unless
> 0 <= Integer(value) && 2**16 > Integer(value)
> end
> end
>
> newproperty(:description) do
> - desc "The port description."
> + desc "The description for the port."
> end
>
> newproperty(:port_aliases, :parent => Puppet::Property::OrderedList) do
> @@ -73,11 +72,10 @@ module Puppet
> end
>
> validate do |value|
> - raise Puppet::Error, "Aliases cannot have whitespaces in them" if
> value =~ /\s/
> + raise Puppet::Error, "Aliases must not contain whitespace: #{value}"
> if value =~ /\s/
> end
> end
>
> -
> newproperty(:target) do
> desc "The file in which to store service information. Only used by
> those providers that write to disk."
> @@ -90,6 +88,5 @@ module Puppet
> end
> end
> end
> -
> end
> end
>
> --
> Jacob Helwig
-Stefan
pgp8t6VxaH7vx.pgp
Description: PGP signature
