Module: MuxTf
- Defined in:
- lib/mux_tf/yaml_cache.rb,
lib/mux_tf.rb,
lib/mux_tf/cli.rb,
lib/mux_tf/tmux.rb,
lib/mux_tf/cli/mux.rb,
lib/mux_tf/version.rb,
lib/mux_tf/coloring.rb,
lib/mux_tf/handlers.rb,
lib/mux_tf/plan_utils.rb,
lib/mux_tf/cli/current.rb,
lib/mux_tf/version_check.rb,
lib/mux_tf/init_formatter.rb,
lib/mux_tf/plan_formatter.rb,
lib/mux_tf/cli/plan_summary.rb,
lib/mux_tf/formatter_common.rb,
lib/mux_tf/terraform_helpers.rb,
lib/mux_tf/resource_tokenizer.rb,
lib/mux_tf/stderr_line_handler.rb,
lib/mux_tf/plan_summary_handler.rb,
lib/mux_tf/handlers/plan_handler.rb,
lib/mux_tf/error_handling_methods.rb,
lib/mux_tf/plan_filename_generator.rb,
lib/mux_tf/cli/current/plan_command.rb
Overview
Ruby 2.7’s YAML doesn’t have a :unsafe_load method .. so we skip all that if YAML.singleton_methods.include?(:unsafe_load)
module YAML
# Explaination from @h4xnoodle:
#
# Since ruby 3+ and psych 4+, the yaml loading became extra safe so the
# expired_at timestamp in the yaml cache is no longer parsing for whatever reason.
#
# Attempts were made with
#
# `@store = YAML::Store.new path`
# =>
# `@store = YAML::Store.new(path, { aliases: true, permitted_classes: [Time] })`
# to get it to work but that didn't help, so decided to just bypass the safe
# loading, since the file is controlled by us for the version checking.
#
# This is to override the way that psych seems to be loading YAML.
# Instead of using 'load' which needs work to permit the 'Time' class
# (which from above I tried that and it wasn't working so I decided to just
# bypass and use what it was doing before).
# This brings us back to the equivalent that was working before in that unsafe
# load was used before the psych upgrade.
#
# This change: https://my.diffend.io/gems/psych/3.3.2/4.0.0
# is the changes that 'cause the problem' and so I'm 'fixing it' by using the old equivalent.
#
# Maybe the yaml cache needs more work to have
# `YAML::Store.new(path, { aliases: true, permitted_classes: [Time] }) work.`
#
class << self
undef load # avoid a warning about the next line redefining load
alias load unsafe_load
end
end
end
Defined Under Namespace
Modules: Cli, Coloring, ErrorHandlingMethods, FormatterCommon, Handlers, TerraformHelpers, Tmux, VersionCheck Classes: InitFormatter, PlanFilenameGenerator, PlanFormatter, PlanSummaryHandler, PlanUtils, ResourceTokenizer, StderrLineHandler, UnsafeYamlStore, YamlCache
Constant Summary collapse
- ROOT =
File.(File.join(__dir__, ".."))
- VERSION =
"0.17.2"