Move provisioner superclass into the V1 namespace
This commit is contained in:
parent
798704c6d2
commit
2e00a007ce
|
@ -73,7 +73,6 @@ module Vagrant
|
||||||
autoload :Guest, 'vagrant/guest'
|
autoload :Guest, 'vagrant/guest'
|
||||||
autoload :Hosts, 'vagrant/hosts'
|
autoload :Hosts, 'vagrant/hosts'
|
||||||
autoload :Plugin, 'vagrant/plugin'
|
autoload :Plugin, 'vagrant/plugin'
|
||||||
autoload :Provisioners, 'vagrant/provisioners'
|
|
||||||
autoload :Registry, 'vagrant/registry'
|
autoload :Registry, 'vagrant/registry'
|
||||||
autoload :SSH, 'vagrant/ssh'
|
autoload :SSH, 'vagrant/ssh'
|
||||||
autoload :TestHelpers, 'vagrant/test_helpers'
|
autoload :TestHelpers, 'vagrant/test_helpers'
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
module Vagrant
|
||||||
|
module Plugin
|
||||||
|
module V1
|
||||||
|
# This is the base class for a provisioner for the V1 API. A provisioner
|
||||||
|
# is primarily responsible for installing software on a Vagrant guest.
|
||||||
|
class Provisioner
|
||||||
|
# The environment which provisioner is running in. This is the
|
||||||
|
# action environment, not a Vagrant::Environment.
|
||||||
|
attr_reader :env
|
||||||
|
|
||||||
|
# The configuration for this provisioner. This will be an instance of
|
||||||
|
# the `Config` class which is part of the provisioner.
|
||||||
|
attr_reader :config
|
||||||
|
|
||||||
|
def initialize(env, config)
|
||||||
|
@env = env
|
||||||
|
@config = config
|
||||||
|
end
|
||||||
|
|
||||||
|
# This method is expected to return a class that is used for
|
||||||
|
# configuring the provisioner. This return value is expected to be
|
||||||
|
# a subclass of {Config}.
|
||||||
|
#
|
||||||
|
# @return [Config]
|
||||||
|
def self.config_class
|
||||||
|
end
|
||||||
|
|
||||||
|
# This is the method called to "prepare" the provisioner. This is called
|
||||||
|
# before any actions are run by the action runner (see {Vagrant::Actions::Runner}).
|
||||||
|
# This can be used to setup shared folders, forward ports, etc. Whatever is
|
||||||
|
# necessary on a "meta" level.
|
||||||
|
#
|
||||||
|
# No return value is expected.
|
||||||
|
def prepare
|
||||||
|
end
|
||||||
|
|
||||||
|
# This is the method called to provision the system. This method
|
||||||
|
# is expected to do whatever necessary to provision the system (create files,
|
||||||
|
# SSH, etc.)
|
||||||
|
def provision!
|
||||||
|
end
|
||||||
|
|
||||||
|
# This is the method called to when the system is being destroyed
|
||||||
|
# and allows the provisioners to engage in any cleanup tasks necessary.
|
||||||
|
def cleanup
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,44 +0,0 @@
|
||||||
module Vagrant
|
|
||||||
module Provisioners
|
|
||||||
# The base class for a "provisioner." A provisioner is responsible for
|
|
||||||
# provisioning a Vagrant system.
|
|
||||||
#
|
|
||||||
# This has been abstracted out so it is easy to provide support for
|
|
||||||
# multiple solutions.
|
|
||||||
class Base
|
|
||||||
include Vagrant::Util
|
|
||||||
|
|
||||||
# The environment which provisioner is running in. This is the
|
|
||||||
# action environment, not a Vagrant::Environment.
|
|
||||||
attr_reader :env
|
|
||||||
|
|
||||||
# The configuration for this provisioner. This will be an instance of
|
|
||||||
# the `Config` class which is part of the provisioner.
|
|
||||||
attr_reader :config
|
|
||||||
|
|
||||||
def initialize(env, config)
|
|
||||||
@env = env
|
|
||||||
@config = config
|
|
||||||
end
|
|
||||||
|
|
||||||
# This method is expected to return a class that is used for configuration
|
|
||||||
# for the provisioner.
|
|
||||||
def self.config_class; end
|
|
||||||
|
|
||||||
# This is the method called to "prepare" the provisioner. This is called
|
|
||||||
# before any actions are run by the action runner (see {Vagrant::Actions::Runner}).
|
|
||||||
# This can be used to setup shared folders, forward ports, etc. Whatever is
|
|
||||||
# necessary on a "meta" level.
|
|
||||||
def prepare; end
|
|
||||||
|
|
||||||
# This is the method called to provision the system. This method
|
|
||||||
# is expected to do whatever necessary to provision the system (create files,
|
|
||||||
# SSH, etc.)
|
|
||||||
def provision!; end
|
|
||||||
|
|
||||||
# This is the method called to when the system is being destroyed
|
|
||||||
# and allows the provisioners to engage in any cleanup tasks necessary.
|
|
||||||
def cleanup; end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -48,7 +48,7 @@ module VagrantPlugins
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if !(provisioner <= Vagrant::Provisioners::Base)
|
if !(provisioner <= Vagrant::Plugin::V1::Provisioner)
|
||||||
errors.add(I18n.t("vagrant.config.vm.provisioner_invalid_class", :shortcut => shortcut))
|
errors.add(I18n.t("vagrant.config.vm.provisioner_invalid_class", :shortcut => shortcut))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ module VagrantPlugins
|
||||||
# This class is a base class where the common functionality shared between
|
# This class is a base class where the common functionality shared between
|
||||||
# chef-solo and chef-client provisioning are stored. This is **not an actual
|
# chef-solo and chef-client provisioning are stored. This is **not an actual
|
||||||
# provisioner**. Instead, {ChefSolo} or {ChefServer} should be used.
|
# provisioner**. Instead, {ChefSolo} or {ChefServer} should be used.
|
||||||
class Base < Vagrant::Provisioners::Base
|
class Base < Vagrant::Plugin::V1::Provisioner
|
||||||
include Vagrant::Util::Counter
|
include Vagrant::Util::Counter
|
||||||
|
|
||||||
def initialize(env, config)
|
def initialize(env, config)
|
||||||
|
@ -15,10 +15,6 @@ module VagrantPlugins
|
||||||
config.provisioning_path ||= "/tmp/vagrant-chef-#{get_and_update_counter(:provisioning_path)}"
|
config.provisioning_path ||= "/tmp/vagrant-chef-#{get_and_update_counter(:provisioning_path)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare
|
|
||||||
raise ChefError, :invalid_provisioner
|
|
||||||
end
|
|
||||||
|
|
||||||
def verify_binary(binary)
|
def verify_binary(binary)
|
||||||
# Checks for the existence of chef binary and error if it
|
# Checks for the existence of chef binary and error if it
|
||||||
# doesn't exist.
|
# doesn't exist.
|
||||||
|
|
|
@ -7,7 +7,7 @@ module VagrantPlugins
|
||||||
error_namespace("vagrant.provisioners.puppet")
|
error_namespace("vagrant.provisioners.puppet")
|
||||||
end
|
end
|
||||||
|
|
||||||
class Puppet < Vagrant::Provisioners::Base
|
class Puppet < Vagrant::Plugin::V1::Provisioner
|
||||||
class Config < Vagrant::Plugin::V1::Config
|
class Config < Vagrant::Plugin::V1::Config
|
||||||
attr_accessor :manifest_file
|
attr_accessor :manifest_file
|
||||||
attr_accessor :manifests_path
|
attr_accessor :manifests_path
|
||||||
|
|
|
@ -5,7 +5,7 @@ module VagrantPlugins
|
||||||
error_namespace("vagrant.provisioners.puppet_server")
|
error_namespace("vagrant.provisioners.puppet_server")
|
||||||
end
|
end
|
||||||
|
|
||||||
class PuppetServer < Base
|
class PuppetServer < Vagrant::Plugin::V1::Provisioner
|
||||||
class Config < Vagrant::Plugin::V1::Config
|
class Config < Vagrant::Plugin::V1::Config
|
||||||
attr_accessor :puppet_server
|
attr_accessor :puppet_server
|
||||||
attr_accessor :puppet_node
|
attr_accessor :puppet_node
|
||||||
|
|
|
@ -3,7 +3,7 @@ require "tempfile"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module Shell
|
module Shell
|
||||||
class Provisioner < Vagrant::Provisioners::Base
|
class Provisioner < Vagrant::Plugin::V1::Provisioner
|
||||||
class Config < Vagrant::Plugin::V1::Config
|
class Config < Vagrant::Plugin::V1::Config
|
||||||
attr_accessor :inline
|
attr_accessor :inline
|
||||||
attr_accessor :path
|
attr_accessor :path
|
||||||
|
|
|
@ -251,7 +251,9 @@ en:
|
||||||
shared_folder_nfs_owner_group: |-
|
shared_folder_nfs_owner_group: |-
|
||||||
Shared folder '%{name}': NFS does not support the owner/group settings.
|
Shared folder '%{name}': NFS does not support the owner/group settings.
|
||||||
provisioner_not_found: "The provisioner '%{shortcut}' doesn't exist."
|
provisioner_not_found: "The provisioner '%{shortcut}' doesn't exist."
|
||||||
provisioner_invalid_class: "The provisioner '%{shortcut}' must inherit from `Vagrant::Provisioners::Base`."
|
provisioner_invalid_class: |-
|
||||||
|
The provisioner '%{shortcut}' must inherit from
|
||||||
|
`Vagrant::Plugin::V1::Provisioner`."
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Translations for commands. e.g. `vagrant x`
|
# Translations for commands. e.g. `vagrant x`
|
||||||
|
@ -647,9 +649,6 @@ en:
|
||||||
running_client_again: "Running chef-client again (failed to converge)..."
|
running_client_again: "Running chef-client again (failed to converge)..."
|
||||||
running_solo: "Running chef-solo..."
|
running_solo: "Running chef-solo..."
|
||||||
running_solo_again: "Running chef-solo again (failed to converge)..."
|
running_solo_again: "Running chef-solo again (failed to converge)..."
|
||||||
invalid_provisioner: |-
|
|
||||||
Vagrant::Provisioners::Chef is not a valid provisioner! Use
|
|
||||||
ChefSolo or ChefClient instead.
|
|
||||||
missing_shared_folders: |-
|
missing_shared_folders: |-
|
||||||
Shared folders that Chef requires are missing on the virtual machine.
|
Shared folders that Chef requires are missing on the virtual machine.
|
||||||
This is usually due to configuration changing after already booting the
|
This is usually due to configuration changing after already booting the
|
||||||
|
|
Loading…
Reference in New Issue