ERROR: RegexpError: end pattern with unmatched parenthesis: /^(no$/i
运行knife bootstrap命令以bootrtap一个节点。我使用我的本地MAC机作为工作站来设置节点,我在这里发现了一个类似的帖子RegexpError in chef when running knife bootstrap但我在./ssh/config文件中没有看到任何问题。我甚至尝试从文件中删除所有注释,并尝试创建一个空的配置文件,但似乎没有任何工作,非常感谢任何帮助。
由于
答案 0 :(得分:1)
我通过添加-V -V选项在调试模式下运行bootstrap命令并分析日志。
knife bootstrap <ip-address> -V -V -x <username> -P <password> --sudo -N <node-name>
我得到了以下调试日志
DEBUG: Looking for bootstrap template in /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife/bootstrap/templates
DEBUG: Found bootstrap template in /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife/bootstrap/templates
DEBUG: Adding <node-ip-address>
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:240:in `initialize': end pattern with unmatched parenthesis: /^(no$/i (RegexpError)
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:240:in `new'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:240:in `pattern2regex'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:115:in `block (2 levels) in load'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:115:in `select'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:115:in `block in load'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:81:in `foreach'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:81:in `load'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:64:in `block in for'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:63:in `each'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:63:in `inject'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb:63:in `for'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh.rb:262:in `configuration_for'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife/ssh.rb:231:in `session_options'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife/ssh.rb:258:in `block in session_from_list'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife/ssh.rb:255:in `each'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife/ssh.rb:255:in `session_from_list'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife/ssh.rb:174:in `configure_session'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife/ssh.rb:541:in `run'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife/bootstrap.rb:392:in `run'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife.rb:416:in `block in run_with_pretty_exceptions'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/local_mode.rb:44:in `with_server_connectivity'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife.rb:415:in `run_with_pretty_exceptions'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/knife.rb:214:in `run'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/knife.rb:148:in `run'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/bin/knife:25:in `<top (required)>'
from /usr/local/bin/knife:50:in `load'
from /usr/local/bin/knife:50:in `<main>'
当我查看节点实例中的/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.0.2/lib/net/ssh/config.rb
文件时,我看到的第一件事是评论:
The Net::SSH::Config class is used to parse OpenSSH configuration files,
# and translates that syntax into the configuration syntax that Net::SSH
# understands. This lets Net::SSH scripts read their configuration (to
# some extent) from OpenSSH configuration files (~/.ssh/config, /etc/ssh_config,
# and so forth).
我的〜/ .ssh / config文件是正确的但我的/ etc / ssh_config文件存在问题,它在同一行中有多个带()的注释,例如:Host * # (no default)
。我摆脱了ssh_config文件完全没有在我的系统中的任何地方使用,并再次尝试使用knife bootstrap命令而没有任何问题。另一种选择可能是修复所有评论并删除()形成评论。