Получение STDERR: Использование: при выполнении команды «mount» после обновления до chef client 16

#chef-infra

#шеф-инфра

Вопрос:

Недавно мы обновили 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
  

Ответ №1:

Не уверен, какова корреляция между версией и этим поведением. Но, похоже, fstype cur_type в mount ресурсе получает nil значение. Возможно, вы захотите проверить, почему cur_type не устанавливается ожидаемое значение.

Пара подсказок, указывающих на то, что проблема заключается в том, как установлена cur_type переменная:

  1. Обратите внимание, что в команде mount: "mount", "-t", "-o", перед -o (параметры) должен быть тип файловой системы.

  2. В Compiled Resource: мы можем видеть, fstype nil куда вы передаете cur_type переменную.

Пожалуйста, проверьте, как устанавливается cur_type переменная. Кажется, есть изменение, которое не устанавливается в новой версии Chef. Вы также можете обновить свой вопрос с этими деталями.