我尝试在EC2上安装CodeDeploy agent
,并遵循以下步骤:
sudo yum -y update
sudo yum -y install ruby
sudo yum -y install wget
cd /home/ec2-user
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/install
sudo chmod +x ./install
sudo ./install auto
我可以看到一个名为install
的文件被下载,ruby也被安装了ruby --version => ruby 3.2.1 (2023-02-08 revision 31819e82c8) [x86_64-linux]
,但是当我运行sudo ./install auto
时,它在下面抛出了这个错误注意我已经在root
user和ec2-user
之间切换了,但是它不起作用!注意我没有Rudy代码要运行
/usr/share/ruby3.2/logger/log_device.rb:83:in `exist?': no implicit conversion of Array into String (TypeError)
if File.exist?(path)
^^^^
from /usr/share/ruby3.2/logger/log_device.rb:83:in `set_dev'
from /usr/share/ruby3.2/logger/log_device.rb:18:in `initialize'
from /usr/share/ruby3.2/logger.rb:587:in `new'
from /usr/share/ruby3.2/logger.rb:587:in `initialize'
from ./install:43:in `new'
from ./install:43:in `<main>'
2条答案
按热度按时间qlfbtfca1#
我看到你在Udemy上学习Stephane的DevOps课程。我自己也遇到了一个问题,试图找出一个解决方案,将root级别的权限赋予ec2-user,并试图通过编辑logger_device.RB文件来遵循@anothermh的答案。
此问题是由于新的amazon 2023 AMI和Ruby Logger类之间的版本不兼容引起的。您需要做的是修复此问题,如下所示:
注意:请记住在创建新示例时重新分配IAM角色。
代码部署代理现在将成功安装并工作。希望这有帮助!
j7dteeu82#
这是
install
脚本的问题。请看第42-43行:这对
Logger
类不起作用:因为传递给
Logger.new
的对象 * 确实 * 响应:path
:我不知道为什么这个脚本是这样写的。也许它在Ruby的早期版本中是有效的。
Logger
类是一种垃圾,所以谁知道呢。只需更改第43行,使其不使用
Proxy
类,选择记录到文件或记录到stdout:如果你真的关心,你可以把它设置为log to multiple destinations,但考虑到你只是想运行脚本,我认为你不关心这个。