tomcat - Puppet - 语法错误 'unpack_tomcat' ;预计 '}'

标签 tomcat puppet

我尝试将tomcat部署到node1代理上

node default {

include lamp

}
node "node1.puppet" {

include tomcat

}

网站.pp

    ├── auth.conf
├── fileserver.conf
├── manifests
│   └── site.pp
├── modules
│   ├── ftp
│   │   ├── files
│   │   │   └── vsftpd.conf
│   │   ├── lib
│   │   └── manifests
│   │       └── init.pp
│   ├── lamp
│   │   ├── lib
│   │   └── manifests
│   │       └── init.pp
│   ├── tomcat
│   │   ├── files
│   │   │   ├── apache-tomcat-8.0.17.zip
│   │   │   ├── script.sh
│   │   │   └── wgetrc
│   │   ├── lib
│   │   └── manifests
│   │       └── init.pp
│   └── unzip
│       └── manifests
│           └── init.pp
└── puppet.conf

我的文件结构..

和/modules/tomcat/manifests/init.pp 的内容

class tomcat {
        exec { "open_ports":
                command => "/bin/firewall-cmd --zone=public --add-port=8080/tcp --permanent",
        }
        exec { "reload_firewall":
                command => "/bin/firewall-cmd --reload",
                require => Exec["open_ports"],
        }
        if $operatingsystem == "centos" {
                file { "/etc/wgetrc":
                        owner => root,
                        group => root,
                        mode => 640,
                        source => "puppet:///modules/tomcat/wgetrc",
                }
        }
        file { "/opt/apache-tomcat-8.0.17.zip":
                owner => root,
                group => root,
                mode => 640,
                source => "puppet:///modules/tomcat/apache-tomcat-8.0.17.zip,
        }
        exec { "unpack_tomcat":
                command => "/usr/bin/unzip apache-tomcat-8.0.17,
                cwd => "/opt",
                require => File["/opt/apache-tomcat-8.0.17"],}

 exec { "create_directorys":
                command => "/bin/mkdir -p /opt/apache-tomcat-8.0.17/instances/original/{lib,work,temp,logs,webapps,bin},
                require => Exec["create_directorys"],
        }
}

我什么都试过了,我找不到错误..我做错了什么?

错误信息,在从 master 拉取目录后..

    [root@node1 puppet]# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at 'unpack_tomcat'; expected '}' at /etc/puppet/modules/tomcat/manifests/init.pp:23 on node node1.puppet
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

提前致谢! :)

更新:

明白了!错误在 init.pp 文件中!

这是新的:

class tomcat {
        exec { "open_ports":
                command => "/bin/firewall-cmd --zone=public --add-port=8080/tcp --permanent",
        }
        exec { "reload_firewall":
                command => "/bin/firewall-cmd --reload",
                require => Exec["open_ports"],
        }
        if $operatingsystem == "centos" {
                file { "/etc/wgetrc":
                        owner => root,
                        group => root,
                        mode => 640,
                        source => "puppet:///modules/tomcat/wgetrc",
                }
        }
        file { "copy_tomcat":
                owner => root,
                group => root,
                mode => 640,
                path => "/opt/apache-tomcat-8.0.17.zip",
                source => "puppet:///modules/tomcat/apache-tomcat-8.0.17.zip",
        }
        exec { "unpack_tomcat":
                command => "/usr/bin/unzip apache-tomcat-8.0.17.zip",
                cwd => "/opt",
                require => File["copy_tomcat"],
        }

        exec { "create_directorys":
                command => "/bin/mkdir -p /opt/apache-tomcat-8.0.17/instances/original/{lib,work,temp,logs,webapps,bin}",
                require => Exec["unpack_tomcat"],
        }
}

最佳答案

这一行少了一个"

source => "puppet:///modules/tomcat/apache-tomcat-8.0.17.zip,

在这些行中有同样的问题

command => "/usr/bin/unzip apache-tomcat-8.0.17,

command => "/bin/mkdir -p /opt/apache-tomcat-8.0.17/instances/original/{lib,work,temp,logs,webapps,bin},

关于tomcat - Puppet - 语法错误 'unpack_tomcat' ;预计 '}',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28062384/

相关文章:

postgresql - 使用 vagrant & puppet,如何在新的 postgresql-server 实例上创建和恢复数据库?

java - Eclipse 中的 Servlet - 放置静态内容的位置

powershell - 将参数安全地传递给使用 Puppet 执行的 Powershell 脚本?

image - Tomcat 中未调用 Servlet

tomcat - 在 Tomcat LifecycleListener 中获取对 jndi 环境变量的访问

puppet - 是否有一个最小的 init.pp 来限制模块的类范围?

shell - 使用 Puppet 设置环境变量

erb - 如何在 Puppet 模板中包含子模板

tomcat - 响应没有被记录?

java - Html Form无需提交自动调用Servlet