我试图在 Terraform 中做一个相当简单的任务,但它不起作用:
变量:
hosted_zone = "example.com"
domain = "my.${var.hosted_zone}"
Run Code Online (Sandbox Code Playgroud)
route_53_record:
resource "aws_route53_record" "regional" {
zone_id = "${data.aws_route53_zone.selected.zone_id}"
name = "${var.domain}"
type = "A"
ttl = "300"
records = ["4.4.4.4"]
}
Run Code Online (Sandbox Code Playgroud)
当我跑步时,terraform plan我得到了这个:
+ aws_route53_record.regional
id: <computed>
allow_overwrite: "true"
fqdn: <computed>
name: "my.${var.hosted_zone}"
records.#: "1"
records.3178571330: "4.4.4.4"
ttl: "300"
type: "A"
zone_id: "REDACTED"
Run Code Online (Sandbox Code Playgroud)
域应该是my.example.com. 如何加入变量 hosts_zoned 和一个字符串以形成域?
我在 OSX 10.11.3 上运行 Vagrant 1.8.1,我正在尝试安装一个插件。在尝试安装时,我收到以下错误:
vagrant plugin install vagrant-libvirt
............
An error occurred while installing ruby-libvirt (0.6.0), and Bundler cannot continue.
Make sure that `gem install ruby-libvirt -v '0.6.0'` succeeds before bundling.
.........
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Run Code Online (Sandbox Code Playgroud)
ruby-livirt 0.6.0 已经安装:
# gem list | grep ruby-libvirt
# ruby-libvirt (0.6.0)
Run Code Online (Sandbox Code Playgroud)
由于 gem 已经安装,我可以绕过这个错误吗?
我有一个正在读取用户输入的脚本。这是我的代码:
if [ -z $volreadexists ]; then
echo -e "\tThis will overwrite the entire volume (/dev/vg01/$myhost)...are you sure?"
read REPLY
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo -e "\t\tContinuing"
syncvolume
else
echo "Fine...skipping"
fi
fi
Run Code Online (Sandbox Code Playgroud)
我必须使用,read REPLY因为read它本身不插入选项卡。我正在寻找类似的东西:
read -p "\tDoes this look OK? (n for No)" -n 1 -r
Run Code Online (Sandbox Code Playgroud)
\t在阅读提示上按 Tab 键。
如何向阅读提示添加选项卡?
更新:感谢@gniourf 的精彩回答!:
read -p $'\tDoes this look OK? (n for No)' -n 1 -r
Run Code Online (Sandbox Code Playgroud)
然而,我发现了一个问题。当我尝试在那里使用变量时,它不会翻译它:
read -p $'\tThis will overwrite …Run Code Online (Sandbox Code Playgroud) 我有一个Rails 5应用程序.我有一个表格,里面填写了从各种来源提取的URL数据:
id url
1 http://google.com
2 http://yahoo.com
3 http://msn.com
4 http://google.com
5 http://yahoo.com
6 http://askjeeves.com
Run Code Online (Sandbox Code Playgroud)
如何从此表中删除重复项?
我有一个包含 Terraform 代码的 Git 存储库,该代码正在部署到 AWS 中。我将 Localstack 添加到此存储库,以便我可以在计划之前进行更高级别的验证测试并将其应用到我的真实 AWS 账户中。为了使用 Localstack,我必须使用自定义端点创建一个新的提供程序:
provider "aws" {
alias = "real"
region = "${local.aws_region}"
}
provider "aws" {
alias = "fake"
region = "${local.aws_region}"
access_key = "fake"
secret_key = "fake"
skip_credentials_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
endpoints {
dynamodb = "http://localhost:4566"
lambda = "http://localhost:4566"
kinesis = "http://localhost:4566"
}
}
Run Code Online (Sandbox Code Playgroud)
如何在不重复代码的情况下使用 Localstack 的一个提供商和 AWS 的一个提供商?
我想用不同版本的 Chrome 进行测试。如何使用 Watir 和 Ruby 指向特定的 Chrome 可执行文件/版本?
我将配置数据存储在以平面文件编写的哈希中.我想将哈希值导入我的类中,以便我可以调用相应的方法.
example.rb
{
:test1 => { :url => 'http://www.google.com' },
:test2 => {
{ :title => 'This' } => {:failure => 'sendemal'}
}
}
Run Code Online (Sandbox Code Playgroud)
simpleclass.rb
class Simple
def initialize(file_name)
# Parse the hash
file = File.open(file_name, "r")
@data = file.read
file.close
end
def print
@data
end
a = Simple.new("simpleexample.rb")
b = a.print
puts b.class # => String
Run Code Online (Sandbox Code Playgroud)
如何将任何"Hashified"字符串转换为实际的哈希?
这是我的例子:
hash = {"buy"=>"Buy ", "quantity"=>"3 ", "get"=>"Get ", "reward"=>"1 ", "free"=>"Free"}
def stripit(value)
#value.gsub!('B', 'C')
value.gsub!('/\s+/', '')
value
end
newhash = hash.update(hash){|key,value| stripit(value)}
puts newhash.inspect
Run Code Online (Sandbox Code Playgroud)
gsub 在价值上工作 - 第一个评论的替换工作 - 但由于某种原因,它不是删除空格.
如何从哈希值中删除空格?
我无法绕过这头,任何帮助都会很棒 ......
我有一个数组$ stores,其结构如下:
Array
(
[0] => Array
(
[id] => 123
[name] => 'Store A'
)
[1] => Array
(
[id] => 345
[name] => 'Store B'
)
[2] => Array
(
[id] => 567
[name] => 'Store C'
)
[3] => Array
(
[id] => 789
[name] => 'Store D'
)
)
Run Code Online (Sandbox Code Playgroud)
我想从这个数组中提取'id'值到一个看起来像这样的简单数组:
$simple = array(123,345,567,789);
Run Code Online (Sandbox Code Playgroud) 我在Centos 6上有一个由jsvc托管的应用程序。与之一起创建了许多日志。我的问题是jsvc正在使用077权限创建那些日志,除了root以外其他任何人都无法访问。日志应该对任何人都是可读的。
jsvc.exec -server -Xms1024M -Xmx2048M -cp myapp.jar -errfile /var/log/myapp/error.log -wait 60 com.myawesomecompany.mysuite.myapp
-rw------- 1 root root 370 Feb 26 16:03 error.log
Run Code Online (Sandbox Code Playgroud)
如何覆盖默认权限,以便生成的任何新日志都具有022权限?