Hi,

I've been stumped by the following error for quite a while now it is
generated when running the manifest further below:

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError:
Invalid resource type drupal6::theme_repo at srv/puppet/modules/
drupal6/manifests/init.pp:129 on node www-cms-dev.fs.uwaterloo.ca


site.pp
----------

class web_cms_dev_server inherits debian_server {
    include apache2
    include drupal6
    include drupal6::dev
}


drupal6/manifests/init.pp
------------------------------------

$d6_confpath = "/usr/share/drupal6"
$d6_scriptpath = "/usr/share/drupal6"
$gitdir = "/srv/git/drupal-themes"

class drupal6 {
    include apache2::rewrite
    include mysql

    # Resources to mount the dev repo share for the drupal themes git
repo and clone and track it
    package { "git-core":
      ensure => present
    }
    file { "/srv/git":
        ensure => "directory",
        owner => "root",
        group => "itstaff",
        mode => 0755
    }
    mount { "/srv/git":
        device => "file-nfs.fs.uwaterloo.ca:/srv/git",
        options => "_netdev,rw,hard,fg,lock,nfsvers=3,tcp",
        fstype => "nfs",
        ensure => mounted,
        require => File["/srv/git"]
    }

    # Use drupal short name as module name to install
    define module ( $ensure = 'present', $site = 'all') {
        case $ensure {
            'present': {
                # TODO: change the exec below to use the script to
test for the module when it has the capability to do so
                # Creates test may not work but does for modules
listed as of commit 3379078fc1d66830d8a88caff42eae2566c4650b
2010-02-03
                exec { "install-module-${name}-site-${site}":
                    creates => "${d6_confpath}/sites/${site}/modules/$
{name}",
                    #command => "drupal-module -d ${d6_confpath}/sites/
${site}/modules -i ${name}",
                    command => "drush -r ${d6_confpath} dl ${name}",
                    timeout => 1500,
                }

                if $require {
                    Exec["install-module-${name}-site-${site}"] {
                        require +> [$require, Package["archive-tar-
minitar"], Package["drupal6"], Package["drush"]]
                    }
                } else {
                    Exec["install-module-${name}-site-${site}"] {
                        require => [Package["archive-tar-minitar"],
Package["drupal6"], Package["drush"]]
                    }
                }
            }
            'absent': {
                # TODO: change the exec below to use the script to
remove the modules when it can
                exec { "remove-module-${name}-site-${site}":
                    onlyif => "test -d ${d6_confpath}/sites/${site}/
modules/${name}",
                    command => "rm -rf ${d6_confpath}/sites/${site}/
modules/${name}"
                }
            }
        }
    }

    # Web developer themes repo
    # theme: name of the theme
    # version: name of the git tag for the desired version
    # upstream: the source url for the git repo. If false a local repo
in $gitdir/$theme is assumed
    # site: the site this theme is applied to
    # Local changes sould be put on the feds branch which should be
rebased onto newer versions
    define theme_repo(
        $theme = "",
        $version = "",
        $site = "default",
        $upstream = "drupal")
    {
        case $upstream {
            # Custom theme, no upstream create an empty bare repo
            false: {
                git::repository { "bare repo $site-$theme":
                    real_name => "$theme",
                    localtree => $gitdir,
                    shared => true,
                    owner => "root",
                    group => "webdeveloper",
                    require => Mount["/srv/git"],
                    before => Git::Clone["$site theme $theme-
$version"]
                }
            }
            # Drupal.org theme, clone from upstream
            "drupal": {
                exec { "clone from upstream $site-$theme":
                    cwd => $gitdir,
                    command => "git clone --bare 
http://git.drupal.org/project/$theme.git
$site-$theme && chown -R root:webdeveloper $site-$theme && chmod -R ug
+w $site-$theme",
                    onlyif => "test ! -d $gitdir/$site-$theme",
                    before => Git::Clone["$site theme $theme-
$version"]
                }
            }
            # Custom upstream theme
            default: {
                exec { "clone from upstream $site-$theme":
                    cwd => $gitdir,
                    command => "git clone --bare $upstream $site-
$theme && chown -R root:webdeveloper $theme && chmod -R ug+w $theme",
                    onlyif => "test ! -d $gitdir/$site-$theme",
                    before => Git::Clone["$site theme $theme-
$version"]
                }
            }
        }

        if $upstream != false {
            exec { "setup $site $theme upstream at $version and feds
branch":
                cwd => "/srv/drupal/$site/themes/$theme",
                command => "git branch v${version} refs/tags/$
{version} && git checkout v${version} && git branch feds && git
checkout feds",
                refreshonly => true,
            }
        }

        # Clone a working dir to Drupal site themes dir
        git::clone { "$site theme $theme-$version":
            source => "$gitdir/$site-$theme",
            localtree => "/srv/drupal/$site/themes",
            real_name => "$theme",
            require => [Package["git-core"], Mount["/srv/git"], File["/
srv/drupal/$site"]],
            notify => Exec["setup $site $theme upstream at $version
and feds branch"]
        }
    }

    # Testing
    define alt_site ($theme) {
        drupal6::theme_repo { "$name-$theme['name']":
              theme => $theme['name'],
              version => $theme['version'],
              upstream => $theme['upstream'],
              site => "default"
          }
    }                                     #
<---------------------------------------- Line 129

    # Drupal site definition
    # In a multi-site setup, for sites other than default the name
    # of drupal6::site must be the domain/subdomain of the site
    # siteAlias can be a string or array of strings. www. prefixes are
added automatically.
    define site (
        $ensure = 'present',
        $dbname,
        $dbpw,
        $dbserver,
        $sitefqdn,
        $siteAlias = "",
        $modules = "",
        $nagios_uid,
        $nagios_timeout = 5,
    ) {
        case $ensure {
            'present': {
                apache2::site { $sitefqdn:
                    ensure => 'present',
                    sitePath => "${d6_scriptpath}",
                    content => template("drupal6/vhost.erb"),
                    require => Package["drupal6"]
                }

                # Export a db
                mysql::database { $dbname:
                    passwd => $dbpw,
                    server => $dbserver,
                    fqdn => $fqdn
                }


                file {
                    "${d6_confpath}/sites/${name}/dbconfig.php":
                        mode => 0440,
                        owner => "www-data",
                        group => "www-data",
                        content => template("drupal6/
dbconfig.php.erb"),
                        require => File["${d6_confpath}/sites/$
{name}"];
                    "${d6_confpath}/sites/${name}/settings.php":
                        mode => 0440,
                        owner => "www-data",
                        group => "www-data",
                        content => template("drupal6/
settings.php.erb"),
                        require => [File["${d6_confpath}/sites/$
{name}"], Exec["create-database-tables-${name}"]];
                    "${d6_confpath}/sites/${name}/files":
                        ensure => "/srv/drupal/${name}/files",
                        force => true,
                        backup => false,
                        require => [File["/srv/drupal/${name}/files"],
File["${d6_confpath}/sites/${name}"]];
                    "${d6_confpath}/sites/${name}/themes":
                        ensure => "/srv/drupal/${name}/themes",
                        force => true,
                        backup => false,
                        require => [File["/srv/drupal/${name}/
themes"], File["${d6_confpath}/sites/${name}"]];
                    "${d6_confpath}/sites/${name}/modules":
                        ensure => directory,
                        mode => 775,
                        owner => "www-data",
                        group => "www-data",
                        require => File["${d6_confpath}/sites/$
{name}"];
                    "${d6_confpath}/sites/${name}/tmp":
                        ensure => directory,
                        mode => 775,
                        owner => "www-data",
                        group => "www-data",
                        require => File["${d6_confpath}/sites/$
{name}"];
                    "/srv/drupal/${name}/files":
                        ensure => directory,
                        mode => 0775,
                        owner => "www-data",
                        group => "www-data",
                        require => File["/srv/drupal/${name}"];
                    "/srv/drupal/${name}/themes":
                        ensure => directory,
                        mode => 0775,
                        owner => "www-data",
                        group => "www-data",
                        require => File["/srv/drupal/${name}"];
                    "/srv/drupal/${name}":
                        ensure => directory,
                        mode => 0775,
                        owner => "www-data",
                        group => "www-data",
                        require => File["/srv/drupal"];
                    "${d6_confpath}/sites/${name}":
                        ensure => directory,
                        mode => 0555,
                        owner => "www-data",
                        group => "www-data";
                }

                # You must visit http://${sitefqdn}/install.php to
complete the rest of the Drupal setup.
                exec { "create-database-tables-${name}":
                    command => "wget -O ${d6_confpath}/sites/${name}/
database-created 'http://${sitefqdn}/install.php?profile=${name}
&locale=en'",
                    creates => "${d6_confpath}/sites/${name}/database-
created"
                }

                # cron job
                exec { "${name}-cron":
                    command => "wget -O - -q -t 1 http://${sitefqdn}/cron.php";
                }

                if $require {
                    File["${d6_confpath}/sites/$name"] {
                        require +> [$require, Package["drupal6"]]
                    }
                } else {
                    File["${d6_confpath}/sites/$name"] {
                        require => Package["drupal6"]
                    }
                }

                # Nagios Drupal site Monitor
                if $nagios_uid {
                    @@nagios_service { "Drupal-$fqdn-$sitefqdn":
                        use => "feds-generic-service",
                        host_name => "$fqdn",
                        servicegroups => "services",
                        service_description => "Drupal-${sitefqdn}",
                        check_command => "check_drupal!${sitefqdn}!$
{nagios_uid}!${nagios_timeout}",
                        contact_groups => "itstaff",
                        target => "/etc/nagios3/conf.d/service_${fqdn}
_Drupal_${sitefqdn}.cfg"
                    }
                }
            }    # 'present'
        }      # case $ensure
    }        # site

    # Initial Installation Stuff
    package { ["drupal6", "drush", "unzip", "php5-curl"]:
        ensure => present,
        require => [Mount["/srv"], User["www-data"], Group["www-
data"], Package["postfix"]]
    }
    package { "archive-tar-minitar":
        ensure => present,
        provider => gem
    }

    file {
      "/srv/drupal":
        ensure => directory,
        mode => 775,
        owner => "www-data",
        group => "www-data",
        require => Package["drupal6"];
    }

    file {
        "${d6_confpath}/sites/all":
            ensure => directory,
            mode => 0555,
            owner => "www-data",
            group => "www-data",
            require => Package["drupal6"];
        "${d6_confpath}/sites/all/libraries":
            ensure => directory,
            mode => 0555,
            owner => "www-data",
            group => "www-data",
            require => File["${d6_confpath}/sites/all"];
        "${d6_confpath}/sites/all/modules":
            ensure => directory,
            mode => 0555,
            owner => "www-data",
            group => "www-data",
            require => File["${d6_confpath}/sites/all"];
    }

}



drupal6/manifests/dev.pp
------------------------------------

class drupal6::dev {
    package { "php5-imap": }

    file { "/srv/git/drupal-themes":
        ensure => directory,
        owner => root,
        group => webdeveloper,
        mode => 0775,
        require => Mount["/srv/git"]
    }

    package {["subversion", "git-svn", "ack-grep"]:
        ensure => present
    }


    drupal6::module { ["fb", "computed_field"]: }

    drupal6::site { "default":
          dbname => "dev-drupal",
          dbpw => "XXXXXXXXXXXXX",
          dbserver => "db.fs.uwaterloo.ca",
          sitefqdn => "dev-drupal.feds.ca",
          nagios_uid => "XXXXXXXXXXXX",
      }

    drupal6::alt_site { "random_test":
          theme => { "name" => "zen", version => "6.x-2.0", "upstream"
=> "drupal" }
    }

}


Both the drupal6::modules and the drupal6::site are referenced and
created fine however the drupal6::alt_site is not.

I've checked everything that I can think of but can't come up with why
I can't have what is essentially:

node 'dev' {
 include d6
 include d6::dev
}

class d6 {
 define site_theme {
   ....
 }

 define site {
   ....
  site_theme { "theme": }
 }
}

class d6::dev {
  d6::site { "site"; }
}

Any help or insight is very much appreciated.



-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@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