elastic-infra/knife-director

View on GitHub
lib/chef/knife/director_bootstrap_windows.rb

Summary

Maintainability
A
25 mins
Test Coverage
# frozen_string_literal: true

require 'chef/knife'
require 'chef/knife/bootstrap_windows_winrm'
require 'chef/knife/director_bootstrap_base'

module ElasticInfra
  # knife bootstrap wrapper for Windows
  class DirectorBootstrapWindows < Chef::Knife::BootstrapWindowsWinrm
    # Wraps like:
    # sudo -E knife bootstrap \
    #   --why-run \
    #   host0001 -N host0001 \
    #   -E production \
    #   --bootstrap-template windows
    DEFAULT_TEMPLATE = 'windows'

    include DirectorBootstrapBase

    deps do
      Chef::Knife::BootstrapWindowsWinrm.load_deps
    end

    banner 'knife director bootstrap windows ' \
           '[SSH_USER@]HOSTNAME -E ENVIRONMENT [options]'

    self.options = BootstrapWindowsWinrm.options.merge(options)

    def initialize(argv = [])
      @default_template = DEFAULT_TEMPLATE
      super
    end
  end
end