Bug 60609
| Summary: | gem-puppet: NoMethodError: undefined method 'exists?' for nil:NilClass в indirector/yaml.rb (touch_dir) при первом сохранении фактов под puppetserver | ||
|---|---|---|---|
| Product: | Branch p11 | Reporter: | obidinog <obidinog> |
| Component: | gem-puppet | Assignee: | majioa <majioa> |
| Status: | NEW --- | QA Contact: | qa-p11 <qa-p11> |
| Severity: | normal | ||
| Priority: | P5 | ||
| Version: | unspecified | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||

Description
obidinog@basealt.ru 2026-09-18 11:00:05 MSKПроверено на стенде Alt Server p11 x86_64. Описание проблемы: При первом обращении Puppet-агента к Puppet Server (когда директория кэша фактов на мастере /var/lib/puppetserver/yaml/facts ещё не существует после чистой установки пакетов), Puppet Server аварийно завершает запрос с кодом HTTP 500 Internal Server Error: undefined method `exists?' for nil:NilClass Агент прерывает работу, каталог не применяется. При этом метод touch_dir успевает создать директорию на диске перед падением, поэтому повторный запуск агента проходит успешно, маскируя проблему. Пакеты на стенде: - Master: gem-puppet-8.4.0-alt2, puppetserver-8.4.0-alt4 - Client: puppet-8.4.0-alt2 Шаги для воспроизведения: 1. На Master: hostnamectl set-hostname puppetmaster echo "$(ip -4 route get 1 | awk '{print $7}') puppet puppetmaster" >> /etc/hosts apt-get update && apt-get install -y puppetserver puppetserver-ca puppet cat << 'EOF' > /etc/puppet/puppet.conf [main] server = puppet ca_server = puppet EOF cat << 'EOF' > /etc/puppet/routes.yaml --- master: facts: terminus: facter cache: yaml EOF systemctl enable --now puppetserver 2. На Client: hostnamectl set-hostname puppetclient echo "<IP_MASTER> puppet" >> /etc/hosts apt-get update && apt-get install -y puppet cat << 'EOF' > /etc/puppet/puppet.conf [main] server = puppet EOF 3. Воспроизведение: - На клиенте: puppet agent -t (отправка CSR) - На мастере: puppetserver ca sign --all (подписание сертификата) - На клиенте: puppet agent -t (запрос каталога) Фактический результат: На клиенте: Notice: Requesting catalog from puppet:8140 (...) Notice: Catalog compiled by puppetmaster Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: undefined method `exists?' for nil:NilClass Did you mean? exit Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run В /var/log/puppetserver/puppetserver.log: ERROR [puppetserver] Puppet Server Error: undefined method `exists?' for nil:NilClass Did you mean? exit /usr/lib/ruby/gemie/gems/puppet-8.4.0/lib/puppet/type/user.rb:514:in `exists?' /usr/lib/ruby/gemie/gems/puppet-8.4.0/lib/puppet/indirector/yaml.rb:65:in `touch_dir' /usr/lib/ruby/gemie/gems/puppet-8.4.0/lib/puppet/indirector/yaml.rb:29:in `save' /usr/lib/ruby/gemie/gems/puppet-8.4.0/lib/puppet/indirector/indirection.rb:329:in `save' /usr/lib/ruby/gemie/gems/puppet-8.4.0/lib/puppet/node/facts.rb:22:in `save' /usr/lib/ruby/gemie/gems/puppet-8.4.0/lib/puppet/indirector/catalog/compiler.rb:45:in `save_facts_from_request' Ожидаемый результат: Puppet Server отдаёт каталог клиенту (HTTP 200) при первом же запросе без ошибок. Локализация в коде: В /usr/lib/ruby/gemie/gems/puppet-8.4.0/lib/puppet/indirector/yaml.rb в методе touch_dir: user = Puppet::Type.type(:user).new(name: Puppet[:user]).exists? ? Puppet[:user] : nil group = Puppet::Type.type(:group).new(name: Puppet[:group]).exists? ? Puppet[:group] : nil В /usr/lib/ruby/gemie/gems/puppet-8.4.0/lib/puppet/type/user.rb (строка 514): def exists? provider.exists? end В окружении Puppet Server (JRuby) нативные системные провайдеры для типа user не загружаются, поэтому provider равен nil. Вызов nil.exists? вызывает NoMethodError. Дополнительно: Проверить наличие данной ошибки на Sisyphus в данный момент не удаётся из-за другого блокирующего бага: в репозитории обновлён пакет gem-multi-json (1.21.1), использующий метод Fiber.[] (из Ruby 3.0), который отсутствует в JRuby внутри puppetserver, в результате чего puppetserver на Sisyphus падает ещё раньше — при любой десериализации JSON («Could not intern from json: undefined method `[]' for Fiber:Class»).