获取 STDERR:用法:while 运行 "mount" 命令升级到 Chef 客户端 16 后

Getting STDERR: Usage: while running "mount" command after upgrading to chef client 16

最近我们将 chef-client 从 12.8.1 升级到 16.1.16。将 chef-client 从 12.8.1 升级到 16.1.16 后,出现以下错误。为了测试,我将 chef-client 恢复到12.8.1 和部署在 12.8.1 上运行良好。是否有任何我缺少的代码重构需要升级到 Chef 16.1.16 版本。

 12:39:35   * mount[Mount volume /ILdata/arc_data04] action mount[2020-09-16T03:09:35-04:00] INFO: 
 Processing mount[Mount volume /ILdata/arc_data04] action mount (il-nfs::client line 74)
 12:39:35 [2020-09-16T03:09:36-04:00] INFO: Retrying execution of mount[Mount volume /ILdata/arc_data04], 
 1 attempt left
 12:39:40 [2020-09-16T03:09:41-04:00] INFO: Retrying execution of mount[Mount volume /ILdata/arc_data04], 
 0 attempt left
 12:39:45 
 12:39:45     
 12:39:45     ================================================================================
 12:39:45     [31mError executing action `mount` on resource 'mount[Mount volume 
 /ILdata/arc_data04]'[0m
 12:39:45     ================================================================================
 12:39:45     
 12:39:45     Mixlib::ShellOut::ShellCommandFailed
 12:39:45     ------------------------------------
 12:39:45     Expected process to exit with [0], but received '1'
 12:39:45     ---- Begin output of ["mount", "-t", "-o", "rw,_netdev,x-systemd.after=network- 
 online.target", "172.XX.XX.XX:/UFS_V5_NEW", "/ILdata/arc_data04"] ----
 12:39:45     STDOUT: 
 12:39:45     STDERR: Usage:
 12:39:45      mount [-lhV]
 12:39:45      mount -a [options]
 12:39:45      mount [options] [--source] <source> | [--target] <directory>
 12:39:45      mount [options] <source> <directory>
 12:39:45      mount <operation> <mountpoint> [<target>]
 12:39:45     
 12:39:45     Options:
 12:39:45      -a, --all               mount all filesystems mentioned in fstab
 12:39:45      -c, --no-canonicalize   don't canonicalize paths
 12:39:45      -f, --fake              dry run; skip the mount(2) syscall
 12:39:45      -F, --fork              fork off for each device (use with -a)
 12:39:45      -T, --fstab <path>      alternative file to /etc/fstab
 12:39:45      -h, --help              display this help text and exit
 12:39:45      -i, --internal-only     don't call the mount.<type> helpers
 12:39:45      -l, --show-labels       lists all mounts with LABELs
 12:39:45      -n, --no-mtab           don't write to /etc/mtab
 12:39:45      -o, --options <list>    comma-separated list of mount options
 12:39:45      -O, --test-opts <list>  limit the set of filesystems (use with -a)
 12:39:45      -r, --read-only         mount the filesystem read-only (same as -o ro)
 12:39:45      -t, --types <list>      limit the set of filesystem types
 12:39:45          --source <src>      explicitly specifies source (path, label, uuid)
 12:39:45          --target <target>   explicitly specifies mountpoint
 12:39:45      -v, --verbose           say what is being done
 12:39:45      -V, --version           display version information and exit
 12:39:45      -w, --rw, --read-write  mount the filesystem read-write (default)
 12:39:45     
 12:39:45      -h, --help     display this help and exit
 12:39:45      -V, --version  output version information and exit
 12:39:45     
 12:39:45     Source:
 12:39:45      -L, --label <label>     synonym for LABEL=<label>
 12:39:45      -U, --uuid <uuid>       synonym for UUID=<uuid>
 12:39:45      LABEL=<label>           specifies device by filesystem label
 12:39:45      UUID=<uuid>             specifies device by filesystem UUID
 12:39:45      PARTLABEL=<label>       specifies device by partition label
 12:39:45      PARTUUID=<uuid>         specifies device by partition UUID
 12:39:45      <device>                specifies device by path
 12:39:45      <directory>             mountpoint for bind mounts (see --bind/rbind)
 12:39:45      <file>                  regular file for loopdev setup
 12:39:45     
 12:39:45     Operations:
 12:39:45      -B, --bind              mount a subtree somewhere else (same as -o bind)
 12:39:45      -M, --move              move a subtree to some other place
 12:39:45      -R, --rbind             mount a subtree and all submounts somewhere else
 12:39:45      --make-shared           mark a subtree as shared
 12:39:45      --make-slave            mark a subtree as slave
 12:39:45      --make-private          mark a subtree as private
 12:39:45      --make-unbindable       mark a subtree as unbindable
 12:39:45      --make-rshared          recursively mark a whole subtree as shared
12:39:45      --make-rslave           recursively mark a whole subtree as slave
12:39:45      --make-rprivate         recursively mark a whole subtree as private
12:39:45      --make-runbindable      recursively mark a whole subtree as unbindable
12:39:45     
12:39:45     For more details see mount(8).
12:39:45     ---- End output of ["mount", "-t", "-o", "rw,_netdev,x-systemd.after=network-online.target", "172.XX.XX.XX:/UFS_V5_NEW", "/ILdata/arc_data04"] ----
12:39:45     Ran ["mount", "-t", "-o", "rw,_netdev,x-systemd.after=network-online.target", "172.XX.XX.XX:/UFS_V5_NEW", "/ILdata/arc_data04"] returned 1
12:39:45     
12:39:45     Resource Declaration:
12:39:45     ---------------------
12:39:45     # In /etc/chef/local-mode-cache/cache/cookbooks/il-nfs/recipes/client.rb
12:39:45     
12:39:45      74:       mount "Mount volume #{cur_path_loc}" do
12:39:45      75:         mount_point cur_path_loc
12:39:45      76:         device cur_path_rem
12:39:45      77:         fstype cur_type
12:39:45      78:         options mount_options
12:39:45      79:         action [ :mount, :enable ]
12:39:45      80:         pass 0
12:39:45      81:         retries 2
12:39:45      82:         retry_delay 5
12:39:45      83:         # we retry because this can occur soon after hostname and dns changes
12:39:45      84:       end
12:39:45      85: 
12:39:45     
12:39:45     Compiled Resource:
12:39:45     ------------------
12:39:45     # Declared in /etc/chef/local-mode-cache/cache/cookbooks/il-nfs/recipes/client.rb:74:in `block in from_file'
12:39:45     
12:39:45     mount("Mount volume /ILdata/arc_data04") do
12:39:45       action [:mount, :enable]
12:39:45       default_guard_interpreter :default
12:39:45       declared_type :mount
12:39:45       cookbook_name "il-nfs"
12:39:45       recipe_name "client"
12:39:45       mount_point "/ILdata/arc_data04"
12:39:45       device "172.XX.XX.XX:/UFS_V5_NEW"
12:39:45       fstype nil
12:39:45       options ["rw", "_netdev", "x-systemd.after=network-online.target"]
12:39:45       pass 0
12:39:45       retries 2
12:39:45       retry_delay 5
12:39:45       supports {:remount=>false}
12:39:45     end
12:39:45     
12:39:45     System Info:
12:39:45     ------------
12:39:45     chef_version=16.1.16
12:39:45     platform=redhat
12:39:45     platform_version=7.7
12:39:45     ruby=ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
12:39:45     program_name=/bin/chef-client
12:39:45     executable=/opt/chef/bin/chef-client

不确定版本与此行为之间的相关性。但似乎 mount 资源中的 fstype cur_type 正在获得 nil 值。您可能想检查为什么 cur_type 没有设置为您期望的值。

一些线索表明问题出在 cur_type 变量的设置方式上:

  1. 注意在mount命令中:"mount", "-t", "-o",-o(选项)之前应该有一个文件系统类型。

  2. Compiled Resource: 中,我们可以看到 fstype nil 您正在传递 cur_type 变量的位置。

请检查 cur_type 变量的设置方式。似乎有一个更改导致 未在新版本的 Chef 中设置。您也可以使用该详细信息更新您的问题。