2015-01-21 67 views
0

我試圖Tomcat的部署到節點1劑Puppet - 'unpack_tomcat'的語法錯誤;預期 '}'

node default { 

include lamp 

} 
node "node1.puppet" { 

include tomcat 

} 

site.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 

我的文件結構..

和/模塊/ 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"], 
     } 
} 

我試過一切,我不能鰭d一個錯誤..我做錯了什麼?

錯誤消息,從主機拉低目錄以後。

[[email protected] 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"], 
     } 
} 

回答

0

有這行

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}, 
+0

謝謝你錯過了" ..有還有一些其他的拼寫錯誤,但你的帖子告訴我正確的方向:) – 2015-01-21 08:31:07

+0

所以如果這是有幫助的,你需要vo如果它解決了你的問題,你需要接受它。 – BMW 2015-01-21 08:32:32

相關問題