Error to cloning project with puppet on vagrant
Question: I am trying to install django and clone a github project with a puppet script.
I am using modules as follows:

  * files 
    * (empty directory)
  * manifests 
    * nodes.pp
    * web.pp
  * modules 
    * django 
      * manifests 
        * init.pp
      * files 
        * (empty directory)
    * git 
      * manifests 
        * init.pp
      * files 
        * (empty directory)
    * postgres

Within the **web.pp** file I have:

    
    
    import ' nodes.pp '
    

In **nodes.pp** file I have:

    
    
    node default {
            include postgres
            include git
            include django
        }
    

In **init.pp** file within the Manifests folder that is inside the git folder
I have the following code:

    
    
    class git{
        include git::install
    }
    
    class git::install{
        package { 'git:':
            ensure => present
        }
    }
    
    define git::clone ( $path, $dir){
        exec { "clone-$name-$path":
            command => "/usr/bin/git clone git@github.com:$name $path/$dir",
            creates => "$path/$dir",
            require => [Class["git"], File[$path]],
        }
    }
    

In **init.pp** file within the Manifests folder that is inside the django
folder I have the following code:

    
    
    class django{
        include django::install, django::clone, django::environment
    }
    
    class django::install {
        package { [ "python", "python-dev", "python-virtualenv", "python-pip",
                    "python-psycopg2", "python-imaging"]:
            ensure => present,
        }
    }
    
    class django::clone {
        git::clone { 'My GitHub repository name':
            path => '/home/vagrant/',
            dir => 'django',
        }
    }
    
     define django::virtualenv( $path ){
         exec { "create-ve-$path":
             command => "/usr/bin/virtualenv -q $name",
             cwd => $path,
             creates => "$path/$name",
             require => [Class["django::install"]],
         }
     }
    
    class django::environment {
        django::virtualenv{ 've':
            path => '/usr/local/app',
        }
    }
    

To run the scripts puppet I use the command:

    
    
    sudo puppet apply --modulepath=/vagrant/modules /vagrant/manifests/web.pp
    

and run this command I get the following **error** :

    
    
    Could not find dependency File[/home/vagrant/] for 
    Exec[clone-My GitHub repository name-/home/vagrant/] at 
    /vagrant/modules/git/manifests/init.pp:16
    

Note: where is the name 'My GitHub repository name', I put the name of my
github repository correctly.

What is wrong and how do I solve this problem?


Answer: in your define git::clone have you made sure to declare the file resource for
$path?

you should have:

    
    
    file { $path: ensure => directory }
    

you can't _require_ a resource that you haven't specifically delcared

