Class: Chef::Knife::ServerBackup
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ServerBackup
- Defined in:
- lib/chef/knife/server_backup.rb
Overview
Backs up a Chef server component.
Instance Method Summary collapse
Instance Method Details
#backup_dir ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/chef/knife/server_backup.rb', line 52 def backup_dir @backup_dir ||= config[:backup_dir] || begin server_host = URI.parse(Chef::Config[:chef_server_url]).host time = Time.now.utc.strftime("%Y%m%dT%H%M%S-0000") base_dir = config[:backup_dir] || Chef::Config[:file_backup_path] ::File.join(base_dir, "#{server_host}_#{time}") end end |
#run ⇒ Object
45 46 47 48 49 50 |
# File 'lib/chef/knife/server_backup.rb', line 45 def run validate! components = name_args.empty? ? COMPONENTS.keys : name_args Array(components).each { |component| backup_component(component) } end |