I will be in #puppet or #puppet-dev for the next hour or so (as bodepd), I
am more than happy to work through this with you.

On Sun, Nov 7, 2010 at 9:55 AM, Otacilio Lacerda
<otaciliolace...@gmail.com>wrote:

> I'm trying to create a new module. When I try to create a module it
> looks like it is not finding the module. I created a new Type,
> provider called "arquivo". The structure looks like:
>
> modules/
> ├── arquivo
> │   ├── lib
> │   │   └── puppet
> │   │       ├── provider
> │   │       │   └── arquivo
> │   │       │       └── arquivo.rb
> │   │       └── type
> │   │           └── arquivo.rb
> │   └── manifests
> │       └── init.pp
>
> My type is the folowing:
> module Puppet newtype(:arquivo) do
>

this doesnt look right, try Puppet::Type.newtype(:foo) do end


>    @doc = "Manage a file (the simple version)."
>    ensurable
>    newparam(:name) do
>        desc "The full path to the file."
>    end
>    newproperty(:mode) do
>        desc "Manage the file's mode."
>        defaultto "640"
>    end
> end
>
> And my provider looks like:
> Puppet::Type.type(:arquivo).provide(:arquivo) do
>    desc "Normal Unix-like POSIX support for file management."
>
>    def destroy
>        File.unlink(@resource[:name])
>    end
>
>    def exists?
>        p "exists?"
>        File.exists?(@resource[:name])
>    end
>
>    def create
>        p "create"
>        File.open(@resource[:name], "w") { |f| f.puts "" } # Create an
> empty file
>        # Make sure the mode is correct
>        should_mode = @resource.should(:mode)
>        unless self.mode == should_mode
>                self.mode = should_mode
>        end
>    end
>
>    # Return the mode as an octal string, not as an integer.
>    def mode
>        p "getmode"
>        if File.exists?(@resource[:name])
>                "%o" % (File.stat(@resource[:name]).mode & 007777)
>        else
>                :absent
>        end
>    end
>
>    # Set the file mode, converting from a string to an integer.
>    def mode=(value)
>        File.chmod(Integer("0" + value), @resource[:name])
>    end
> end
>
> The manifest that I created is:
> class arquivo {
>
>        arquivo {"arquivo":
>                ensure => present ,
>                name => "/tmp/teste",
>                mode => 777
>        }
> }
>
> class file {
>
>        file { "/tmp/bla":
>                ensure => present
>        }
> }
>
> node "cliente.britania" {
>        include arquivo, file
> }
>
> When I run the puppet from my client (puppetd -td) I can see the new
> file "bla" created by the class file, but I don't find any file
> created by the class "arquivo" (I guess my module is not running).
>
> myfileserver.conf:
> [files]
>  path /etc/puppet/files
>  allow 10.0.0.0/8
>
> [plugins]
>  allow 10.0.0.0/8
>
> All other puppet configurations are default and I'm using Ubuntu 10.10.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to