Class: VagrantPlugins::WinAzure::Provisioner::Puppet
- Inherits:
-
Object
- Object
- VagrantPlugins::WinAzure::Provisioner::Puppet
- Defined in:
- lib/vagrant-azure/provisioner/puppet.rb
Instance Attribute Summary collapse
-
#provisioner ⇒ Object
readonly
Returns the value of attribute provisioner.
Instance Method Summary collapse
-
#initialize(env) ⇒ Puppet
constructor
A new instance of Puppet.
- #provision_for_windows ⇒ Object
Constructor Details
#initialize(env) ⇒ Puppet
Returns a new instance of Puppet.
14 15 16 17 |
# File 'lib/vagrant-azure/provisioner/puppet.rb', line 14 def initialize(env) @env = env @provisioner = env[:provisioner] end |
Instance Attribute Details
#provisioner ⇒ Object (readonly)
Returns the value of attribute provisioner.
12 13 14 |
# File 'lib/vagrant-azure/provisioner/puppet.rb', line 12 def provisioner @provisioner end |
Instance Method Details
#provision_for_windows ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/vagrant-azure/provisioner/puppet.rb', line 19 def provision_for_windows = [config.].flatten @module_paths = provisioner.instance_variable_get('@module_paths') @hiera_config_path = provisioner.instance_variable_get( '@hiera_config_path' ) @manifest_file = provisioner.instance_variable_get('@manifest_file') # Copy the manifests directory to the guest if config.manifests_path[0].to_sym == :host @env[:machine].provider.driver.upload( File.( config.manifests_path[1], @env[:machine].env.root_path ), provisioner.manifests_guest_path ) end # Copy the module paths to the guest @module_paths.each do |from, to| @env[:machine].provider.driver.upload(from.to_s, to) end module_paths = @module_paths.map { |_, to| to } unless module_paths.empty? win_paths = [] # Prepend the default module path module_paths.unshift('/ProgramData/PuppetLabs/puppet/etc/modules') module_paths.each do |path| path = path.gsub('/', '\\') path = "C:#{path}" if path =~/^\\/ win_paths << path end # Add the command line switch to add the module path << "--modulepath \"#{win_paths.join(';')}\"" end if @hiera_config_path << "--hiera_config=#{@hiera_config_path}" # Upload Hiera configuration if we have it local_hiera_path = File.( config.hiera_config_path, @env[:machine].env.root_path ) @env[:machine].provider.driver.upload( local_hiera_path, @hiera_config_path ) end << "--manifestdir #{provisioner.manifests_guest_path}" << "--detailed-exitcodes" << @manifest_file = .join(' ') # Build up the custome facts if we have any facter = '' unless config.facter.empty? facts = [] config.facter.each do |key, value| facts << "FACTER_#{key}='#{value}'" end facter = "#{facts.join(' ')}" end command = "#{facter}puppet apply #{}" if config.working_directory command = "cd #{config.working_directory} && #{command}" end @env[:ui].info I18n.t( 'vagrant.provisioners.puppet.running_puppet', manifest: config.manifest_file ) @env[:ui].info 'Executing puppet script in Windows Azure VM' @env[:machine].provider.driver.run_remote_ps(command) do |type, data| # Output the data with the proper color based on the stream. if (type == :stdout || type == :stderr) @env[:ui].detail data end end end |