Open aniruddhanavare opened 8 years ago
It has been seen that, certain JSON block is missing during BACKUP of the this particular entry. Other entries are working fine.
I think I'm seeing the same thing. So I take a backup and inside the node.json appears to have the correct ipaddress and all of the attributes, but when I do a "knife backup restore nodes", I also see empty attributes on "knife node show ..."
For me, I'm using: knife-backup (0.0.12) chef-dk (0.14.25)
thx guys - I will look into this when I have a bit more. Currently swamped!!!
Any movement on this issue? I'm attempting to migrate from one Chef server to another and knife-backup isn't restoring any of my node attributes at all as far as I can tell.
From looking at the code, it doesn't appear like much data is actually ever repopulated by the method that ends up getting called -- either from_json
or from_hash
, depending on the version: http://www.rubydoc.info/gems/chef/Chef%2FNode.from_hash
My solution was ... less than ideal.
require 'chef'
require 'chef/knife'
# grab config data from old chef server
Chef::Config.from_file(File.join(Chef::Knife.chef_config_dir, 'knife.rb'))
nodes = Chef::Node.list(true) # takes a while
# switch to new chef config data in knife.rb, client.pem
Chef::Config.from_file(File.join(Chef::Knife.chef_config_dir, 'knife.rb'))
nodes.each { |(name, node)| puts "saving #{name}"; node.save }
# grab a coffee
Not happy-fun-times, but it works.
As the PR was outstanding for sometime and has now been pulled I'd add the following
knife download https://docs.chef.io/knife_download.html and knife upload https://docs.chef.io/knife_upload.html ought to be able to backup and restore a Chef Server.
The above commands use ChefFS http://www.rubydoc.info/gems/chef/Chef/ChefFS which runs much quicker than knife backup which iterates each Chef object and downloads them.
Using knife download It is possible to download the contents of the Chef Server or individual components such as nodes, roles, environments to the filesystem. Cookbooks etc are latest versions.
The contents of the folder created with knife download can then be sent back up to a new Chef Server or restored using knife upload.
If individual items are to be restored you can use knife <node|role|environment> from file
Examples. Download all items from Chef Server
knife download / --chef-repo-path "c:/temp/chef/backup"
Downloads just environments
knife download environments --chef-repo-path "c:/temp/chef/backup/environments"
NB: Just make sure your folder structure exists because knife download is not very good at creating folders.
Restore a single node
knife node from file awsome.machine.com.json
Restore all items
knife upload .
Restore just environments
knife upload environments
Finally, if you want to backup a single node you can re-direct the output of knife node show
knife node show <node_name> -l -F json > <node_name>.json
Sorry guy - been really busy lately. Main issue at the moment is to test any changes against multiple chef server versions. So when problems are reported or fixes are suggested, note the chef server version as well. thanks
I am using knife backup - restore plugin with following configuration
knife plugin version : 0.0.12 chef server version : 11.18.12
It has been found that, after restore, certain node attributes are not visible when we do "knife show node" command.
I have virtual machine, which has following attributes.
Command : knife node show falRhel6x64.ammpilot.FALCON.release.ibm.com Output
Node Name: falRhel6x64.ammpilot.FALCON.release.ibm.com Environment: _default FQDN: falRhel6x64.ammpilot.FALCON.release.ibm.com IP: 159.8.215.239 Run List: recipe[zabbix-agent::linux], role[SetupPatchingNode] Roles: ScanForPatches Recipes: patchservice_operations::ScanEndpoints Platform: redhat 7.2 Tags:
When I do backup using knife backup and proceed with restore operation, same node shows following attributes when it is queried
[root@localhost ~]# knife node show falRhel6x64.ammpilot.FALCON.release.ibm.com Node Name: falRhel6x64.ammpilot.FALCON.release.ibm.com Environment: _default FQDN:
IP:
Run List: recipe[zabbix-agent::linux], role[SetupPatchingNode] Roles:
Recipes:
Platform:
Tags:
If you see, certain attributes are missing. It has been seen that, certain JSON block is missing.