- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在编写一个 LWRP 以使用 API key 为 redis 数据库播种以允许进行身份验证。我的麻烦是使用 ruby 的 redis 库。我四处搜索并在网上找到了一些示例,但没有一个对我有用。
我在 AWS OpsWorks 上运行它,所以它使用的是 chef-solo
我已经尝试在我的运行列表中包含一个安装 redis gem ( https://github.com/brianbianco/redisio/blob/master/recipes/redis_gem.rb ) 的方法
我也试过在 Recipe 中安装它们 gem。
r = gem_package "redis" do
action :install
end
r.run_action(:install)
或
r = chef_gem "redis" do
action :install
end
r.run_action(:install)
这是我在 Chef 运行中遇到的错误
[2013-10-03T16:11:41+00:00] DEBUG: filtered backtrace of compile error:
[2013-10-03T16:11:41+00:00] DEBUG: filtered backtrace of compile error:
[2013-10-03T16:11:41+00:00] DEBUG: backtrace entry for compile error: '/opt/aws/opsworks/releases/20130926123105_208/site-cookbooks/ilnkmx/providers/add_app.rb:1:in `require''
[2013-10-03T16:11:41+00:00] DEBUG: Line number of compile error: '1'
[2013-10-03T16:11:42+00:00] ERROR: Caught exception while compiling OpsWorks custom run list: LoadError - no such file to load -- redis - /opt/aws/opsworks/releases/20130926123105_208/site-cookbooks/ilnkmx/providers/add_app.rb:1:in `require'
我是 ruby 的新手,所以非常感谢您的帮助,谢谢。
最佳答案
看来我遗漏了一小块,而且我在错误的地方放置了一些东西。
首先我需要在我的 Recipe 中安装 redis gem 后刷新 gem,如下所示。
r = chef_gem "redis" do
action :nothing
end
r.run_action(:install)
Gem.clear_paths
我还要求我的提供程序中的库不正确。我需要在 Gem.clear_paths
之后在我的 Recipe 中要求它,然后在我的提供者中我将打开连接并预制添加、删除或更新记录,如下所示。
action :create do
if @current_resource.exists
Chef::Log.info "#{ @new_resource } already exist - nothing to do."
else
converge_by("Create #{ @new_resource }") do
create_app_key
end
end
end
def create_app_key
redis = ::Redis.new
redis.set "#{@new_resource.app_name}", "#{@new_resource.api_key}"
end
关于ruby - 在 chef lwrp 中安装、要求和使用 ruby 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19164144/
我有一个类和构造函数,如下所示: def init(log, edge): if edge: return Helper(log, edge) return Booka
关闭。这个问题需要更多focused .它目前不接受答案。 想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post . 4年前关闭。 Improve this questi
有人知道在 mongo 上安装标准 ubuntu 需要多少磁盘空间和内存吗?试图找出我的 VPS 需求... 最佳答案 没有最低要求,但我不建议在与您的网络服务器相同的机器上运行 Mongo。 Mon
我的 Django 项目有一个虚拟环境,但是当我 pip 击 pip freeze 时,我得到了一个必须是全局站 pip 包列表的东西,包括太多包,比如ubuntu包和这么多不相关的东西。无论 vir
我曾尝试在 Heroku 上部署我的应用程序,但 smth 出错了。 错误:找不到满足要求的版本 get==2019.4.13(来自 -r/tmp/build_53ad6d03_/requiremen
我无法将 semantic-ui-calendar npm 模块加载到我的应用程序中。 我已经使用脚本标签成功地将它加载到我的 HTML 中, 但每次我尝试将它加载到我的应用程序中时,我都会出错。 在
如何修复 php.ini 中“require”函数内的地址?它进行故障排除并显示错误: 警告:require (..) 无法打开流:没有这样的文件或目录。 文件“db_connection.php”工
我有一个在 Node.js 应用程序中使用的外部库 ( Objection.js )。我创建了一个基本模型类,它为我的实体模型扩展了 Objection 的 Model 类: const { Mode
有谁知道在哪里可以找到RHEL5的GLIBC2.7,如果没有这个,Android模拟器将无法启动。它会给出一条消息,要求GLIBC 2.7或更高版本。 我尝试在网上搜索,但没有找到 最佳答案 我也遇到
Android 设备是否有任何要求/指南?例如按钮数量或所需的最少按钮数量。 还有没有菜单和后退按钮的安卓设备吗? (我知道就可用性而言,没有菜单/后退按钮会杀死大多数应用程序,我只是想了解更多有关该
我想要求/包含一个文件并将其内容检索到一个变量中。 test.php index.php ".$test; ?> 类似于 file_get_contents() 但它仍应执行 PHP 代码。这可能吗
我想要求/包含一个文件并将其内容检索到一个变量中。 test.php index.php ".$test; ?> 类似于 file_get_contents() 但它仍应执行 PHP 代码。这可能吗
我正在尝试在我的 Linux Mint 发行版上安装一个 python 模块“pyAudioProcessing”(https://github.com/jsingh811/pyAudioProces
我已经创建了我的第一个 composer 包,它具有 MySQL 和 MongoDB 的功能,但是,它不需要两者。我意识到有人可能只想将这个包与两个数据库之一一起使用,目前我有: "require":
我想调试以下函数,但假设在调试器中查看 moreajaj 的参数等于什么(假设不像在这个人为的示例中那么明显)是有用的。我可以在调试器框架中打印它,但是在每个参数的每个框架中都这样做很烦人。在宣布每一
我有一些生成的 GNUmakefiles,我需要从中提取变量的值。 有没有一种简单的方法可以在不修改 makefile 的情况下查看变量的值? 仅供引用,变量包含 emacs c-macro-expa
我正在使用 aspell 在 Linux 上拼写检查 LaTeX 文档。我的文档经常包含各种编程语言的代码示例,我希望 aspell 在拼写检查时简单地跳过这些行。 我可以在文档中写些什么来关闭一段文
我有一个包含多个列的数据集... 一列是具有重复值的主石斑鱼列,另一列是具有 bool 值 (1,0) 的 NUMBER,如下所示: grp bool --- ---- A 1 A 1 A
出于测试目的,我正在尝试删除一些 amd 模块并从服务器重新加载更新版本 - 目的是不刷新浏览器。 我目前正在执行以下操作,但浏览器仍然没有从网络重新加载项目。 var scripts = docum
当我键入irb> require 'rubygems'时,它返回false。我的Rails应用程序中有很多 gem ,这些 gem 显然可以正常工作-耙子,activerecord等。这里可能出什么问
我是一名优秀的程序员,十分优秀!