chef / chef_backup

A library to backup an Chef server
Other
7 stars 15 forks source link

restore fails with [ERROR] no implicit conversion of nil into String #26

Open kpersohn opened 7 years ago

kpersohn commented 7 years ago

On a clean RHEL 7.2 box:

  1. Install Chef server 12.10.0
  2. chef-server-ctl reconfigure
  3. chef-server-ctl backup

On a clean RHEL 7.2 box:

  1. Install Chef Server 12.10.0
  2. chef-server-ctl reconfigure
  3. chef-server-ctl restore --cleanse backup.tgz Fails, with [ERROR] no implicit conversion of nil into String

Similar in spirit to chef/chef-server#959

I also tried restoring to the same box that was backed up and adding some content (user + org) to the server prior to backup with the same results.

shatil commented 7 years ago

Encountered the same error on Ubuntu "Trusty" 14.04 running chef-server-core-12.11.1-1, and tried to restore a backup using chef-server-ctl restore that I created on another machine a few hours ago using chef-server backup.

Same as OP:

timeout: run: redis_lb: (pid 4888) 419s, want down, got TERM
Terminating processes running under application users. This will take a few seconds.
Your config files have been backed up to /root/opscode-cleanse-2016-12-05T22:02.
[ERROR] no implicit conversion of nil into String
shatil commented 7 years ago

@kpersohn for what it's worth, I was able to back up and restore following the manual instructions: https://docs.chef.io/server_backup_restore.html

Beware though, that since chef-server-ctl restore does a chef-server-ctl cleanse, you'll probably have to do a chef-server-ctl reconfigure before you can start PostgreSQL to restore the database.

bdwyertech commented 7 years ago

Fixed by #27

The DataMap classes addconfig method was putting the config directory under a config key, rather than data_dir key which is referenced by the restore process.

https://github.com/chef/chef_backup/blob/master/lib/chef_backup/data_map.rb#L35

For the time being, you can edit the embedded Gem to fix new backups. opt/opscode/embedded/lib/ruby/gems/2.2.0/gems/chef_backup-0.0.1/lib/chef_backup/data_map.rb

Any backups taken prior to this will need their embedded manifests edited. The edit would involve the following.

Before:

  "configs": {
    "opscode": {
      "config": "/etc/opscode"
    }

After:

  "configs": {
    "opscode": {
      "data_dir": "/etc/opscode"
    }

As you can see in the manifest below, the services have a data_dir defined, but configs does not.

{
  "strategy": "tar",
  "backup_time": "2016-12-08-06-34-27",
  "topology": "standalone",
  "ha": {
  },
  "services": {
    "rabbitmq": {
      "data_dir": "/var/opt/opscode/rabbitmq/db"
    },
    "opscode-solr4": {
      "data_dir": "/var/opt/opscode/opscode-solr4/data"
    },
    "redis_lb": {
      "data_dir": "/var/opt/opscode/redis_lb/data"
    },
    "postgresql": {
      "data_dir": "/var/opt/opscode/postgresql/9.2/data",
      "pg_dump_success": true,
      "username": "opscode-pgsql"
    },
    "bookshelf": {
      "data_dir": "/var/opt/opscode/bookshelf/data"
    },
    "upgrades": {
      "data_dir": "/var/opt/opscode/upgrades"
    }
  },
  "configs": {
    "opscode": {
      "config": "/etc/opscode"
    }
  },
  "versions": {
    "opscode": {
      "version": "12.11.0",
      "revision": "5c836a047ed5e5124b52bb946abc18c71c297024",
      "path": "/opt/opscode/version-manifest.json"
    }
  }
}