1

我收到以下语法错误:

但我在我的代码中没有发现任何错误。谁能解释原因并帮助我解决它?

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at '::nfs::server::export' at /etc/puppetlabs/code/environments/production/modules/profiles/manifests/nfsserver.pp:18:21 on node puppetmaster.solartis.net
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

以下是我尝试过的木偶代码。请通过以下。

class profiles::nfsserver($nfs_exports_global=hiera_hash('nfs::nfs_exports_global',
false)) inherits nfs {
  class {
    '::nfs': server_enabled=> true, client_enabled=> false, nfs_v4=> true, nfs_v4_idmap_domain=> $: : domain, nfs_v4_export_root=>'/opt/JbossRepo', nfs_v4_export_root_clients=>'192.168.5.0/24(rw,fsid=root,insecure,no_subtree_check,async,no_root_squash)',
  }
  $defaults_nfs_exports= {
    ensure=>'mounted', clients=>'192.168.5.0/24(rw,insecure,no_subtree_check,async,no_root_squash)

  }
  if $nfs_exports_global {
    create_resources('::nfs::server::export', $nfs_exports_global, $defaults_nfs_exports)
  }
}

4

1 回答 1

3

我发现了一个丢失的单 ' (执行 diff -bw 以查看它在哪里)用于puppet parser validate获取反馈

class profiles::nfsserver($nfs_exports_global=hiera_hash('nfs::nfs_exports_global',
false)) inherits nfs {
  class {
    '::nfs': server_enabled=> true, client_enabled=> false, nfs_v4=> true, nfs_v4_idmap_domain=> $::domain, nfs_v4_export_root=>'/opt/JbossRepo', nfs_v4_export_root_clients=>'192.168.5.0/24(rw,fsid=root,insecure,no_subtree_check,async,no_root_squash)',
  }
  $defaults_nfs_exports= {
    ensure=>'mounted', clients=>'192.168.5.0/24(rw,insecure,no_subtree_check,async,no_root_squash)'

  }
  if $nfs_exports_global {
    create_resources('::nfs::server::export', $nfs_exports_global, $defaults_nfs_exports)
  }
}
于 2016-01-27T13:06:04.693 回答