在 Puppet 中为 /etc/fstab 使用 augeas 时遇到问题
Trouble using augeas for /etc/fstab in Puppet
我很确定我在这个 class 中有一些语法错误,其中有一个 augeas
资源。
这是我的代码:
#
# This class was created to deal with /etc/fstab on openstack nodes
#
class myfstab (
$spec = 'uig003:/uig003/uig003_OSC_vol003A',
# spec Example uig003:/uig003/uig003_OSC_vol003A
$mount_point = '/data',
# Example /data
$vfstype = 'nfs',
# Example nfs
$opt_1 = 'rw',
# Example rw
$opt_2 = 'bg',
#Example bg
$opt_3 = 'hard',
#Example hard
$opt_4 = 'intr',
#Example intr
$opt_5 = 'rsize=32768',
#Example rsize=32768
$opt_6 = 'wsize=32768',
#Example wsize=32768
$opt_7 = 'tcp',
#Example tcp
$opt_8 = 'vers=3',
#Example vers=3
$dump = 0,
#Example 0
$passno = 0,
#Example 0
) {
augeas{ 'data_mount' :
context => '/files/etc/fstab',
changes => [
“set 01/spec $spec",
“set 01/file $mount_point",
“set 01/vfstype $vfstype”,
“set 01/opt[1] $opt_1”,
“set 01/opt[2] $opt_2”,
“set 01/opt[3] $opt_3",
“set 01/opt[4] $opt_4",
“set 01/opt[5] $opt_5",
“set 01/opt[6] $opt_6",
“set 01/opt[7] $opt_7",
“set 01/opt[8] $opt_8",
“set 01/dump $dump”,
“set 01/passno $passno”,
],
}
}
当我 运行 puppet parser validate init.pp
时,我收到此错误消息:
Error: Could not parse for environment production: Could not match “set at /etc/puppetlabs/puppet/modules/myfstab/manifests/init.pp:35
第 35 行是...
“set 01/spec $spec",
...行。
谢谢。
从您的代码来看,您的代码似乎包含弯(印刷)双引号而不是 ASCII 双引号。这就是 puppet 所追求的。
我很确定我在这个 class 中有一些语法错误,其中有一个 augeas
资源。
这是我的代码:
#
# This class was created to deal with /etc/fstab on openstack nodes
#
class myfstab (
$spec = 'uig003:/uig003/uig003_OSC_vol003A',
# spec Example uig003:/uig003/uig003_OSC_vol003A
$mount_point = '/data',
# Example /data
$vfstype = 'nfs',
# Example nfs
$opt_1 = 'rw',
# Example rw
$opt_2 = 'bg',
#Example bg
$opt_3 = 'hard',
#Example hard
$opt_4 = 'intr',
#Example intr
$opt_5 = 'rsize=32768',
#Example rsize=32768
$opt_6 = 'wsize=32768',
#Example wsize=32768
$opt_7 = 'tcp',
#Example tcp
$opt_8 = 'vers=3',
#Example vers=3
$dump = 0,
#Example 0
$passno = 0,
#Example 0
) {
augeas{ 'data_mount' :
context => '/files/etc/fstab',
changes => [
“set 01/spec $spec",
“set 01/file $mount_point",
“set 01/vfstype $vfstype”,
“set 01/opt[1] $opt_1”,
“set 01/opt[2] $opt_2”,
“set 01/opt[3] $opt_3",
“set 01/opt[4] $opt_4",
“set 01/opt[5] $opt_5",
“set 01/opt[6] $opt_6",
“set 01/opt[7] $opt_7",
“set 01/opt[8] $opt_8",
“set 01/dump $dump”,
“set 01/passno $passno”,
],
}
}
当我 运行 puppet parser validate init.pp
时,我收到此错误消息:
Error: Could not parse for environment production: Could not match “set at /etc/puppetlabs/puppet/modules/myfstab/manifests/init.pp:35
第 35 行是...
“set 01/spec $spec",
...行。
谢谢。
从您的代码来看,您的代码似乎包含弯(印刷)双引号而不是 ASCII 双引号。这就是 puppet 所追求的。