backup/backup

NameError: uninitialized constant Backup::Config::DSL::True

jmvbxx opened this issue · 3 comments

What went wrong?

For several months we've been running the backup gem without issue and as of six days ago the process has begun to fail with the following error:

[2017/09/07 13:35:17][error] CLI::Error
[2017/09/07 13:35:17][error] --- Wrapped Exception ---
[2017/09/07 13:35:17][error] NameError: uninitialized constant Backup::Config::DSL::True
[2017/09/07 13:35:17][error] /home/ubuntu/Backup/models/zabbix_backup.rb:20:in `block (3 levels) in load'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/database/mysql.rb:65:in `instance_eval'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/database/mysql.rb:65:in `initialize'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/model.rb:146:in `new'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/model.rb:146:in `database'
[2017/09/07 13:35:17][error] /home/ubuntu/Backup/models/zabbix_backup.rb:13:in `block (2 levels) in load'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/model.rb:127:in `instance_eval'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/model.rb:127:in `initialize'
[2017/09/07 13:35:17][error] /home/ubuntu/Backup/models/zabbix_backup.rb:12:in `new'
[2017/09/07 13:35:17][error] /home/ubuntu/Backup/models/zabbix_backup.rb:12:in `block in load'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/config.rb:48:in `instance_eval'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/config.rb:48:in `block in load'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/config.rb:47:in `each'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/config.rb:47:in `load'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/lib/backup/cli.rb:129:in `perform'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/backup-4.4.0/bin/backup:5:in `<top (required)>'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/bin/backup:23:in `load'
[2017/09/07 13:35:17][error] /home/ubuntu/.rbenv/versions/2.2.6/bin/backup:23:in `<main>'

What steps did you follow?

Change the steps below to match the commands that you ran

Ubuntu 16.04 LTS/ruby 2.2.6p396/Backup 4.4.0
/home/ubuntu/.rbenv/shims/backup perform --trigger zabbix_backup causes the above error. Also backup check causes the same error.

As I mentioned, what's confusing is that this process worked so well for so long and for the life of me I have no idea what might have caused it to suddenly stop.

How is your copy of backup configured?

config.rb

# encoding: utf-8

##
# Backup v4.x Configuration
#
# Documentation: http://backup.github.io/backup
# Issue Tracker: https://github.com/backup/backup/issues

##
# Config Options
#
# The options here may be overridden on the command line, but the result
# will depend on the use of --root-path on the command line.
#
# If --root-path is used on the command line, then all paths set here
# will be overridden. If a path (like --tmp-path) is not given along with
# --root-path, that path will use it's default location _relative to --root-path_.
#
# If --root-path is not used on the command line, a path option (like --tmp-path)
# given on the command line will override the tmp_path set here, but all other
# paths set here will be used.
#
# Note that relative paths given on the command line without --root-path
# are relative to the current directory. The root_path set here only applies
# to relative paths set here.
#
# ---
#
# Sets the root path for all relative paths, including default paths.
# May be an absolute path, or relative to the current working directory.
#
# root_path 'my/root'
#
# Sets the path where backups are processed until they're stored.
# This must have enough free space to hold apx. 2 backups.
# May be an absolute path, or relative to the current directory or +root_path+.
#
# tmp_path  'my/tmp'
#
# Sets the path where backup stores persistent information.
# When Backup's Cycler is used, small YAML files are stored here.
# May be an absolute path, or relative to the current directory or +root_path+.
#
# data_path 'my/data'

##
# Utilities
#
# If you need to use a utility other than the one Backup detects,
# or a utility can not be found in your $PATH.
#
#   Utilities.configure do
#     tar       '/usr/bin/gnutar'
#     redis_cli '/opt/redis/redis-cli'
#   end

##
# Logging
#
# Logging options may be set on the command line, but certain settings
# may only be configured here.
#
#   Logger.configure do
#     console.quiet     = true            # Same as command line: --quiet
#     logfile.max_bytes = 2_000_000       # Default: 500_000
#     syslog.enabled    = true            # Same as command line: --syslog
#     syslog.ident      = 'my_app_backup' # Default: 'backup'
#   end
#
# Command line options will override those set here.
# For example, the following would override the example settings above
# to disable syslog and enable console output.
#   backup perform --trigger my_backup --no-syslog --no-quiet

##
# Component Defaults
#
# Set default options to be applied to components in all models.
# Options set within a model will override those set here.
#
#   Storage::S3.defaults do |s3|
#     s3.access_key_id     = "my_access_key_id"
#     s3.secret_access_key = "my_secret_access_key"
#   end
#
#   Notifier::Mail.defaults do |mail|
#     mail.from                 = 'sender@email.com'
#     mail.to                   = 'receiver@email.com'
#     mail.address              = 'smtp.gmail.com'
#     mail.port                 = 587
#     mail.domain               = 'your.host.name'
#     mail.user_name            = 'sender@email.com'
#     mail.password             = 'my_password'
#     mail.authentication       = 'plain'
#     mail.encryption           = :starttls
#   end

##
# Preconfigured Models
#
# Create custom models with preconfigured components.
# Components added within the model definition will
# +add to+ the preconfigured components.
#
#   preconfigure 'MyModel' do
#     archive :user_pictures do |archive|
#       archive.add '~/pictures'
#     end
#
#     notify_by Mail do |mail|
#       mail.to = 'admin@email.com'
#     end
#   end
#
#   MyModel.new(:john_smith, 'John Smith Backup') do
#     archive :user_music do |archive|
#       archive.add '~/music'
#     end
#
#     notify_by Mail do |mail|
#       mail.to = 'john.smith@email.com'
#     end
#   end

zabbix_backup.rb

# encoding: utf-8

##
# Backup Generated: zabbix_backup
# Once configured, you can run the backup with the following command:
#
# $ backup perform -t zabbix_backup [-c <path_to_configuration_file>]
#
# For more information about Backup's components, see the documentation at:
# http://backup.github.io/backup
#
Model.new(:{{ backup_name }}, '{{ backup_description }}') do
  database MySQL do |db|
    db.name               = "{{ backup_db_name }}"
    db.username           = "{{ backup_db_username }}"
    db.password           = "{{ backup_db_password }}"
    db.socket             = "{{ backup_db_socket }}"
    db.sudo_user          = "{{ backup_db_sudo_user }}"
    db.additional_options = {{ backup_db_additional_options }}
    db.prepare_backup     = {{ backup_db_prepare_backup }}
  end

  ##
  # Amazon Simple Storage Service [Storage]
  #
  store_with S3 do |s3|
    s3.access_key_id     = "{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
    s3.secret_access_key = "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}"
    s3.region            = "{{ backup_db_s3_region }}"
    s3.bucket            = "{{ backup_db_s3_bucket }}"
    s3.keep              = {{ backup_db_s3_keep }}
  end

  ##
  # Local (Copy) [Storage]
  #
  store_with Local do |local|
    local.path       = "~/backups/"
    local.keep       = 5
  end

  ##
  # Gzip [Compressor]
  #
  compress_with Gzip

end

Any guidance would be much appreciated! Thank you in advance!

Discovered the error and somehow a boolean was set to True instead of true. Closing!

hehe 😅 that's not the first time I've seen that. Where did the capitalized True come from?