Permalink
Browse files

Death to Syck! Long live Psych

  • Loading branch information...
1 parent 870cdbd commit ad60ba5aa28d1628c4cfcf0a207b0d6aba42ceb1 Alex Jackson and Amit Gupta committed Mar 29, 2013
Showing with 298 additions and 313 deletions.
  1. +3 −3 aws/bin/ami
  2. +1 −1 bat/lib/deployment.rb
  3. +1 −1 bat/lib/stemcell.rb
  4. +1 −1 bat/spec/helpers/deployment_helper.rb
  5. +1 −1 blobstore_client/bin/blobstore_client_console
  6. +0 −2 bosh_agent/lib/bosh_agent.rb
  7. +2 −2 bosh_agent/lib/bosh_agent/apply_plan/job.rb
  8. +1 −1 bosh_agent/lib/bosh_agent/http_handler.rb
  9. +4 −4 bosh_agent/lib/bosh_agent/state.rb
  10. +7 −7 bosh_agent/spec/unit/apply_plan/job_spec.rb
  11. +1 −1 bosh_agent/spec/unit/heartbeat_spec.rb
  12. +1 −1 bosh_agent/spec/unit/message/drain_spec.rb
  13. +2 −2 bosh_agent/spec/unit/state_spec.rb
  14. +4 −4 bosh_aws_bootstrap/spec/functional/aws_spec.rb
  15. +2 −2 bosh_aws_bootstrap/spec/functional/bootstrap_spec.rb
  16. +2 −2 bosh_aws_bootstrap/spec/unit/bat_manifest_spec.rb
  17. +2 −2 bosh_aws_bootstrap/spec/unit/bosh_manifest_spec.rb
  18. +2 −2 bosh_aws_bootstrap/spec/unit/microbosh_manifest_spec.rb
  19. +1 −1 bosh_aws_cpi/bin/bosh_aws_console
  20. +0 −4 bosh_cli/lib/cli.rb
  21. +1 −1 bosh_cli/lib/cli/blob_manager.rb
  22. +1 −1 bosh_cli/lib/cli/commands/biff.rb
  23. +2 −2 bosh_cli/lib/cli/commands/deployment.rb
  24. +1 −1 bosh_cli/lib/cli/commands/job_management.rb
  25. +4 −4 bosh_cli/lib/cli/commands/job_rename.rb
  26. +1 −1 bosh_cli/lib/cli/commands/release.rb
  27. +1 −1 bosh_cli/lib/cli/commands/stemcell.rb
  28. +2 −2 bosh_cli/lib/cli/config.rb
  29. +1 −1 bosh_cli/lib/cli/core_ext.rb
  30. +3 −3 bosh_cli/lib/cli/deployment_helper.rb
  31. +4 −4 bosh_cli/lib/cli/release.rb
  32. +1 −1 bosh_cli/lib/cli/release_builder.rb
  33. +1 −1 bosh_cli/lib/cli/stemcell.rb
  34. +1 −1 bosh_cli/lib/cli/versions_index.rb
  35. +30 −32 bosh_cli/lib/cli/yaml_helper.rb
  36. +14 −0 bosh_cli/spec/assets/manifests/new_extra_changes_manifest.yml
  37. +15 −0 bosh_cli/spec/assets/manifests/new_extra_job_rename_manifest.yml
  38. +15 −0 bosh_cli/spec/assets/manifests/new_manifest.yml
  39. +15 −0 bosh_cli/spec/assets/manifests/new_manifest_missing_new_job.yml
  40. +14 −0 bosh_cli/spec/assets/manifests/new_manifest_with_some_deletions.yml
  41. +15 −0 bosh_cli/spec/assets/manifests/old_manifest.yml
  42. +5 −5 bosh_cli/spec/unit/blob_manager_spec.rb
  43. +1 −1 bosh_cli/spec/unit/cli_commands/base_command_spec.rb
  44. +1 −1 bosh_cli/spec/unit/cli_commands/cli_commands_spec.rb
  45. +6 −101 bosh_cli/spec/unit/cli_commands/job_rename_spec.rb
  46. +1 −1 bosh_cli/spec/unit/config_spec.rb
  47. +1 −1 bosh_cli/spec/unit/core_ext_spec.rb
  48. +2 −2 bosh_cli/spec/unit/deployment_helper_spec.rb
  49. +1 −1 bosh_cli/spec/unit/job_builder_spec.rb
  50. +2 −2 bosh_cli/spec/unit/release_builder_spec.rb
  51. +1 −1 bosh_deployer/lib/deployer/config.rb
  52. +3 −3 bosh_deployer/lib/deployer/instance_manager.rb
  53. +1 −1 bosh_deployer/lib/deployer/instance_manager/aws.rb
  54. +1 −1 bosh_deployer/lib/deployer/instance_manager/openstack.rb
  55. +1 −1 bosh_deployer/lib/deployer/specification.rb
  56. +1 −1 bosh_deployer/spec/functional/deployer_test_spec.rb
  57. +4 −4 bosh_deployer/spec/unit/aws/config_spec.rb
  58. +3 −3 bosh_deployer/spec/unit/aws/instance_manager_spec.rb
  59. +3 −3 bosh_deployer/spec/unit/config_spec.rb
  60. +3 −3 bosh_deployer/spec/unit/instance_mananager_spec.rb
  61. +4 −4 bosh_deployer/spec/unit/openstack/config_spec.rb
  62. +3 −3 bosh_deployer/spec/unit/openstack/instance_manager_spec.rb
  63. +3 −3 bosh_deployer/spec/unit/vcloud/config_spec.rb
  64. +3 −3 bosh_deployer/spec/unit/vcloud/instance_manager_spec.rb
  65. +1 −1 bosh_openstack_cpi/bin/bosh_openstack_console
  66. +1 −1 bosh_registry/lib/bosh_registry/yaml_helper.rb
  67. +2 −2 bosh_registry/spec/unit/runner_spec.rb
  68. +2 −2 bosh_vcloud_cpi/spec/spec_helper.rb
  69. +1 −1 director/bin/console
  70. +1 −1 director/bin/director
  71. +1 −1 director/bin/drain_workers
  72. +1 −1 director/bin/migrate
  73. +2 −2 director/bin/worker
  74. +1 −1 director/db/migrations/director/20110617211923_add_deployments_release_versions.rb
  75. +1 −1 director/lib/director.rb
  76. +1 −1 director/lib/director/configuration_hasher.rb
  77. +1 −1 director/lib/director/jobs/update_deployment.rb
  78. +2 −2 director/lib/director/jobs/update_release.rb
  79. +1 −1 director/lib/director/jobs/update_stemcell.rb
  80. +1 −1 director/spec/cpi/sandbox.rb
  81. +8 −8 director/spec/functional/director_controller_spec.rb
  82. +2 −2 director/spec/spec_helper.rb
  83. +1 −1 director/spec/unit/api_controller_spec.rb
  84. +1 −1 director/spec/unit/config_spec.rb
  85. +1 −1 director/spec/unit/jobs/delete_release_spec.rb
  86. +1 −1 director/spec/unit/jobs/update_deployment_spec.rb
  87. +1 −1 health_monitor/lib/health_monitor/yaml_helper.rb
  88. +1 −1 health_monitor/spec/unit/agent_manager_spec.rb
  89. +5 −5 package_compiler/lib/package_compiler/compiler.rb
  90. +2 −2 package_compiler/spec/unit/basic_spec.rb
  91. +2 −2 rake/spec.rake
  92. +5 −5 rake/stemcell.rake
  93. +1 −1 release/jobs/micro_aws/prepare
  94. +1 −1 release/jobs/micro_openstack/prepare
  95. +1 −1 release/jobs/micro_vcloud/prepare
  96. +1 −1 release/jobs/micro_vsphere/prepare
  97. +1 −1 release/jobs/utility/prepare
  98. +1 −1 ruby_vcloud_sdk/spec/spec_helper.rb
  99. +1 −1 simple_blobstore_server/bin/simple_blobstore_server
  100. +2 −2 spec/integration/cli_spec.rb
  101. +2 −2 spec/publish_ami.rb
  102. +1 −1 spec/spec_helper.rb
  103. +1 −1 stemcell_builder/stages/stemcell/apply.sh
  104. +1 −1 stemcell_builder/stages/stemcell_openstack/apply.sh
View
@@ -14,7 +14,7 @@ REGIONS = %w[
]
config_file = ARGV[0]
-config = YAML.load_file(config_file)
+config = Psych.load_file(config_file)
fog = Bosh::Ami::Fog.new(config)
@@ -24,9 +24,9 @@ end
begin
File.open(config_file, "w") do |file|
- YAML.dump(config, file)
+ Psych.dump(config, file)
end
rescue => e
puts "failed to save host file: #{e.message}"
- puts YAML.dump(config)
+ puts Psych.dump(config)
end
View
@@ -29,7 +29,7 @@ def generate_deployment_manifest(spec)
erb = ERB.new(load_template(@context.spec.cpi))
result = erb.result(@context.get_binding)
puts result if debug?
- @yaml = YAML::load(result)
+ @yaml = Psych::load(result)
store_manifest(result)
end
View
@@ -11,7 +11,7 @@ def self.from_path(path)
Dir.mktmpdir do |dir|
sh("tar xzf #{path} --directory=#{dir} stemcell.MF")
stemcell_manifest = "#{dir}/stemcell.MF"
- st = YAML.load_file(stemcell_manifest)
+ st = Psych.load_file(stemcell_manifest)
Stemcell.new(st['name'], st['version'], st['cloud_properties']['infrastructure'], path)
end
end
@@ -125,7 +125,7 @@ def reload_deployment_spec
end
def load_deployment_spec
- @spec ||= YAML.load_file(BH::read_environment('BAT_DEPLOYMENT_SPEC'))
+ @spec ||= Psych.load_file(BH::read_environment('BAT_DEPLOYMENT_SPEC'))
# Always set the batlight.missing to something, or deployments will fail.
# It is used for negative testing.
@spec["properties"]["batlight"] ||= {}
@@ -34,7 +34,7 @@ unless @provider && config_file
exit(1)
end
-@config = YAML.load_file(config_file)
+@config = Psych.load_file(config_file)
module ConsoleHelpers
def bsc
@@ -67,8 +67,6 @@ module Bosh
require "bosh_agent/handler"
-YAML::ENGINE.yamler = 'syck' if defined?(YAML::ENGINE.yamler)
-
module Bosh::Agent
BOSH_APP = BOSH_APP_USER = BOSH_APP_GROUP = "vcap"
@@ -87,8 +87,8 @@ def bind_configuration
FileUtils.mkdir_p(bin_dir)
begin
- manifest = YAML.load_file(manifest_path)
- rescue ArgumentError
+ manifest = Psych.load_file(manifest_path)
+ rescue Psych::SyntaxError
install_failed("malformed job manifest #{manifest_path}")
end
@@ -90,7 +90,7 @@ def release_apply_spec
end
def apply_spec
- YAML.load_file(release_apply_spec)
+ Psych.load_file(release_apply_spec)
end
end
end
@@ -48,7 +48,7 @@ def ips
def read
@lock.synchronize do
if File.exists?(@state_file)
- state = YAML.load_file(@state_file) || default_state
+ state = Psych.load_file(@state_file) || default_state
unless state.kind_of?(Hash)
raise_format_error(state)
end
@@ -61,7 +61,7 @@ def read
self
rescue SystemCallError => e
raise StateError, "Cannot read agent state file `#{@state_file}': #{e}"
- rescue YAML::Error
+ rescue Psych::SyntaxError
raise StateError, "Malformed agent state: #{e}"
end
@@ -74,13 +74,13 @@ def write(new_state)
@lock.synchronize do
File.open(@state_file, "w") do |f|
- f.puts(YAML.dump(new_state))
+ f.puts(Psych.dump(new_state))
end
@data = new_state
end
true
- rescue SystemCallError, YAML::Error => e
+ rescue SystemCallError, Psych::SyntaxError => e
raise StateError, "Cannot write agent state file `#{@state_file}': #{e}"
end
@@ -106,7 +106,7 @@ def mock_template(blobstore_id, checksum, path)
}
mock_template("beefdad", "badcafe", job.install_path) do |template|
- template.add_file("job.MF", YAML.dump(manifest))
+ template.add_file("job.MF", Psych.dump(manifest))
template.add_file("templates/foo.erb", "<%= spec.key1 %>")
template.add_file("templates/bar.erb", "<%= spec.key2 %>")
template.add_file("templates/test", "<%= \"\#{name}, \#{index}\" %>")
@@ -211,7 +211,7 @@ def template_for(job)
}
template_for(job) do |template|
- template.add_file("job.MF", YAML.dump(manifest))
+ template.add_file("job.MF", Psych.dump(manifest))
end
expect {
@@ -230,7 +230,7 @@ def template_for(job)
}
template_for(job) do |template|
- template.add_file("job.MF", YAML.dump(manifest))
+ template.add_file("job.MF", Psych.dump(manifest))
end
template_path = File.join(job.install_path, "templates", "foo.erb")
@@ -250,7 +250,7 @@ def template_for(job)
}
template_for(job) do |template|
- template.add_file("job.MF", YAML.dump(manifest))
+ template.add_file("job.MF", Psych.dump(manifest))
template.add_file("templates/foo.erb", "<%= properties.foo.bar %>")
end
@@ -273,7 +273,7 @@ def template_for(job)
}
template_for(job) do |template|
- template.add_file("job.MF", YAML.dump(manifest))
+ template.add_file("job.MF", Psych.dump(manifest))
template.add_file("templates/foo.erb", "<%= p('foo.bar') %>")
end
@@ -303,7 +303,7 @@ def template_for(job)
job = make_job(JOB_NAME, valid_spec["name"], valid_spec, config_binding)
mock_template("beefdad", "badcafe", job.install_path) do |template|
- template.add_file("job.MF", YAML.dump({}))
+ template.add_file("job.MF", Psych.dump({}))
template.add_file("monit", "check process ccdb\nmode manual\n" +
"<%= properties.foo %>")
template.add_file("extra.monit", "check process ccdb_extra\n")
@@ -343,7 +343,7 @@ def template_for(job)
job = make_job(JOB_NAME, valid_spec["name"], valid_spec, config_binding)
mock_template("beefdad", "badcafe", job.install_path) do |template|
- template.add_file("job.MF", YAML.dump({}))
+ template.add_file("job.MF", Psych.dump({}))
template.add_file("monit", "check process ccdb\nmode manual\n" +
"<%= properties.foo.bar %>")
end
@@ -6,7 +6,7 @@
before(:each) do
state_file = Tempfile.new("state")
- state_file.write(YAML.dump({ "job" => {"name" => "mutator" }, "index" => 3, "configuration_hash" => "deadbeef" }))
+ state_file.write(Psych.dump({ "job" => {"name" => "mutator" }, "index" => 3, "configuration_hash" => "deadbeef" }))
state_file.close
@state = Bosh::Agent::State.new(state_file.path)
@@ -7,7 +7,7 @@
def set_state(state)
state_file = Tempfile.new("agent-state")
- state_file.write(YAML.dump(state))
+ state_file.write(Psych.dump(state))
state_file.close
Bosh::Agent::Config.state = Bosh::Agent::State.new(state_file.path)
end
@@ -39,14 +39,14 @@ def make_state(file)
Time.stub!(:now).and_return(ts)
File.open(@state_file, "w") do |f|
- f.write(YAML.dump({ "a" => 1, "b" => 2}))
+ f.write(Psych.dump({ "a" => 1, "b" => 2}))
end
state = make_state(@state_file)
state.to_hash.should == { "a" => 1, "b" => 2 }
File.open(@state_file, "w") do |f|
- f.write(YAML.dump({ "a" => 2, "b" => 3}))
+ f.write(Psych.dump({ "a" => 2, "b" => 3}))
end
# Someone else re-wrote the file, we don't know about that
@@ -25,7 +25,7 @@
end
it "uses some of the normal director keys" do
- @micro_bosh_yaml = YAML.load_file("micro_bosh.yml")
+ @micro_bosh_yaml = Psych.load_file("micro_bosh.yml")
@micro_bosh_yaml['name'].should == "micro-dev102"
@micro_bosh_yaml['network']['vip'].should == "50.200.100.1"
@@ -48,7 +48,7 @@
aws.stub(:target_required)
aws.stub_chain(:director, :uuid).and_return("deadbeef")
aws.create_bosh_manifest(create_vpc_output_yml, route53_receipt_yml)
- YAML.load_file("bosh.yml")['name'].should == "vpc-bosh-dev102"
+ Psych.load_file("bosh.yml")['name'].should == "vpc-bosh-dev102"
end
end
end
@@ -173,7 +173,7 @@ def make_fake_vpc!(overrides = {})
aws.output_state["vpc"]["id"].should == "vpc id"
aws.output_state["vpc"]["subnets"].should == {"bosh" => "amz-subnet1", "name2" => "amz-subnet2"}
- aws.output_state["original_configuration"].should == YAML.load_file(config_file)
+ aws.output_state["original_configuration"].should == Psych.load_file(config_file)
end
context "when the VPC is not immediately available" do
@@ -703,7 +703,7 @@ def make_fake_rds!(opts = {})
# TODO: Where are the assertions for this test? Buried in `make_fake_rds!`? Fix this!
it "should create all rds databases with option overrides" do
- ccdb_opts = YAML.load_file(config_file)["rds"].find { |db_opts| db_opts["name"] == "ccdb" }
+ ccdb_opts = Psych.load_file(config_file)["rds"].find { |db_opts| db_opts["name"] == "ccdb" }
make_fake_rds!(aws_creation_options: ccdb_opts["aws_creation_options"])
aws.create_rds_dbs(config_file, receipt_file)
end
@@ -13,7 +13,7 @@
around do |example|
@bosh_config = Tempfile.new("bosh_config")
- @bosh_config.puts File.read(bosh_config)
+ FileUtils.cp(bosh_config, @bosh_config.path)
aws.add_option(:config, @bosh_config.path)
FileUtils.cp(asset("id_spec_rsa"), "/tmp/somekey")
@@ -288,7 +288,7 @@
aws.bootstrap_bosh(bosh_repository_path)
config_file = File.read(@bosh_config.path)
- config = YAML.load(config_file)
+ config = Psych.load(config_file)
config["target"].should == "http://50.200.100.3:25555"
end
@@ -1,9 +1,9 @@
require 'spec_helper'
describe Bosh::Aws::BatManifest do
- let(:vpc_receipt) { YAML.load_file(asset "test-output.yml") }
+ let(:vpc_receipt) { Psych.load_file(asset "test-output.yml") }
let(:vpc_config) { vpc_receipt['original_configuration'] }
- let(:route53_receipt) { YAML.load_file(asset "test-aws_route53_receipt.yml") }
+ let(:route53_receipt) { Psych.load_file(asset "test-aws_route53_receipt.yml") }
let(:stemcell_version) { '1.1.1.pre' }
let(:manifest) { Bosh::Aws::BatManifest.new(vpc_receipt, route53_receipt, stemcell_version, 'deadbeef') }
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Bosh::Aws::BoshManifest do
- let(:vpc_receipt) { YAML.load_file(asset "test-output.yml") }
- let(:route53_receipt) { YAML.load_file(asset "test-aws_route53_receipt.yml") }
+ let(:vpc_receipt) { Psych.load_file(asset "test-output.yml") }
+ let(:route53_receipt) { Psych.load_file(asset "test-aws_route53_receipt.yml") }
it "sets the correct elastic ip" do
described_class.new(vpc_receipt, route53_receipt, 'deadbeef').vip.should == "50.200.100.3"
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Bosh::Aws::MicroboshManifest do
- let(:vpc_receipt) { YAML.load_file(asset "test-output.yml") }
- let(:route53_receipt) { YAML.load_file(asset "test-aws_route53_receipt.yml") }
+ let(:vpc_receipt) { Psych.load_file(asset "test-output.yml") }
+ let(:route53_receipt) { Psych.load_file(asset "test-aws_route53_receipt.yml") }
let(:vpc_config) { vpc_receipt['original_configuration'] }
let(:manifest) { Bosh::Aws::MicroboshManifest.new(vpc_receipt, route53_receipt) }
@@ -25,7 +25,7 @@ unless config_file
exit(1)
end
-@config = YAML.load_file(config_file)
+@config = Psych.load_file(config_file)
module ConsoleHelpers
def cpi
View
@@ -81,10 +81,6 @@ module Cli
require "cli/runner"
require "cli/base_command"
-if defined?(YAML::ENGINE.yamler)
- YAML::ENGINE.yamler = RUBY_VERSION >= "2.0.0" ? "psych" : "syck"
-end
-
tmpdir = Dir.mktmpdir
at_exit { FileUtils.rm_rf(tmpdir) }
ENV["TMPDIR"] = tmpdir
@@ -352,7 +352,7 @@ def strip_blobs_dir(path)
# Updates blobs index
def update_index
- yaml = YAML.dump(@index).gsub(/\s*$/, "")
+ yaml = Psych.dump(@index).gsub(/\s*$/, "")
index_file = Tempfile.new("blob_index")
index_file.puts(yaml)
@@ -210,7 +210,7 @@ def load_template_as_yaml
temp_data = File.read(@template_file)
temp_data.gsub!(/<%=.*%>/, "INSERT_DATA_HERE")
temp_data.gsub!(/[ ]*<%.*%>[ ]*\n/, "")
- YAML::load(temp_data)
+ Psych::load(temp_data)
end
# Gets the network's network/mask for configuring things such as the
@@ -91,7 +91,7 @@ def perform
:yaml => true, :resolve_properties => true)
if interactive?
- inspect_deployment_changes(YAML.load(manifest_yaml))
+ inspect_deployment_changes(Psych.load(manifest_yaml))
say("Please review all changes carefully".yellow)
end
@@ -273,7 +273,7 @@ def row_for_deployments_table(deployment)
def row_for_deployments_table_by_manifest(deployment_name)
raw_manifest = director.get_deployment(deployment_name)
if (raw_manifest.has_key?("manifest"))
- manifest = YAML.load(raw_manifest["manifest"])
+ manifest = Psych.load(raw_manifest["manifest"])
stemcells = manifest["resource_pools"].map { |rp|
rp["stemcell"].values_at("name", "version").join("/")
@@ -43,7 +43,7 @@ def recreate_job(job, index = nil)
def change_job_state(operation, job, index)
auth_required
manifest_yaml = prepare_deployment_manifest(:yaml => true)
- manifest = YAML.load(manifest_yaml)
+ manifest = Psych.load(manifest_yaml)
unless [:start, :stop, :restart, :recreate].include?(operation)
err("Unknown operation `#{operation}': supported operations are " +
Oops, something went wrong.

0 comments on commit ad60ba5

Please sign in to comment.