~nvalcarcel/ubuntu/lucid/puppet/fix-546677

« back to all changes in this revision

Viewing changes to test/lib/puppettest/support/resources.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-12-23 00:48:10 UTC
  • mfrom: (1.1.10 upstream) (3.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091223004810-3i4oryds922g5n59
Tags: 0.25.1-3ubuntu1
* Merge from debian testing.  Remaining changes:
  - debian/rules:
    + Don't start puppet when first installing puppet.
  - debian/puppet.conf, lib/puppet/defaults.rb:
    + Move templates to /etc/puppet
  - lib/puppet/defaults.rb:
    + Fix /var/lib/puppet/state ownership.
  - man/man8/puppet.conf.8: 
    + Fix broken URL in manpage.
  - debian/control:
    + Update maintainer accordint to spec.
    + Puppetmaster Recommends -> Suggests
    + Created puppet-testsuite as a seperate. Allow the users to run puppet's 
      testsuite.
  - tests/Rakefile: Fix rakefile so that the testsuite can acutally be ran.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
module PuppetTest::Support::Resources
7
7
    def tree_resource(name)
8
 
        Puppet::Type.type(:file).create :title => name, :path => "/tmp/#{name}", :mode => 0755
 
8
        Puppet::Type.type(:file).new :title => name, :path => "/tmp/#{name}", :mode => 0755
9
9
    end
10
 
    
 
10
 
11
11
    def tree_container(name)
12
12
        Puppet::Type::Component.create :name => name, :type => "yay"
13
13
    end
14
 
    
 
14
 
15
15
    def treenode(config, name, *resources)
16
16
        comp = tree_container name
17
 
        resources.each do |resource| 
 
17
        resources.each do |resource|
18
18
            if resource.is_a?(String)
19
19
                resource = tree_resource(resource)
20
20
            end
23
23
        end
24
24
        return comp
25
25
    end
26
 
    
 
26
 
27
27
    def mktree
28
 
        catalog = Puppet::Node::Catalog.new do |config|
 
28
        catalog = Puppet::Resource::Catalog.new do |config|
29
29
            one = treenode(config, "one", "a", "b")
30
30
            two = treenode(config, "two", "c", "d")
31
31
            middle = treenode(config, "middle", "e", "f", two)
32
32
            top = treenode(config, "top", "g", "h", middle, one)
33
33
        end
34
 
        
 
34
 
35
35
        return catalog
36
36
    end
37
37
end