Sha256: 2a8eb2ef50f00d15c0a2dd5bc6bc4acb1c1a2e1cf5a8d3368d2ba11e9f9748e8

Contents?: true

Size: 1.7 KB

Versions: 54

Compression:

Stored size: 1.7 KB

Contents

# frozen_string_literal: true

module VagrantPlugins
  module ProviderZone
    module Command
      # This is used to configure snapshots for the zone
      class ConfigureSnapshots < Vagrant.plugin('2', :command)
        def execute
          options = {}
          opts = OptionParser.new do |o|
            o.banner = 'Usage: vagrant zone zfssnapshot list [options]'
            o.on('--dataset DATASETPATH/ALL', 'Specify path to enable snapshots on, defaults to ALL') do |p|
              options[:dataset] = p
            end
            frequencymsg = 'Set a policy with one of the available optional frequencies'
            o.on('--set_frequency <hourly/daily/weekly/monthly/all>', frequencymsg) do |p|
              options[:set_frequency] = p
            end
            frequency_rtnmsg = 'Number of snapshots to take for the frequency policy'
            o.on('--set_frequency_rtn <#>/defaults ', frequency_rtnmsg) do |p|
              options[:set_frequency_rtn] = p
            end
            deletemsg = 'Delete frequency policy'
            o.on('--delete  <hourly/daily/weekly/monthly/all>', deletemsg) do |p|
              options[:delete] = p
            end
            listmsg = 'Show Cron Policies'
            o.on('--list  <hourly/daily/weekly/monthly/all>', listmsg) do |p|
              options[:list] = p
            end
          end

          argv = parse_options(opts)
          return unless argv

          unless argv.length <= 4
            @env.ui.info(opts.help)
            return
          end

          with_target_vms(argv, provider: :zone) do |machine|
            driver = machine.provider.driver
            driver.zfs(@env.ui, 'cron', options)
          end
        end
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
vagrant-zones-0.1.98 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.97 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.96 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.94 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.93 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.92 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.91 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.90 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.89 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.88 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.87 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.86 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.85 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.84 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.83 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.82 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.81 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.80 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.79 lib/vagrant-zones/command/configure_snapshots.rb
vagrant-zones-0.1.78 lib/vagrant-zones/command/configure_snapshots.rb