Class: VagrantPlugins::WinAzure::Action::OSType
- Inherits:
-
Object
- Object
- VagrantPlugins::WinAzure::Action::OSType
- Defined in:
- lib/vagrant-azure/action/os_type.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ OSType
constructor
A new instance of OSType.
Constructor Details
#initialize(app, env) ⇒ OSType
Returns a new instance of OSType.
12 13 14 15 |
# File 'lib/vagrant-azure/action/os_type.rb', line 12 def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant_azure::action::os_type') end |
Instance Method Details
#call(env) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vagrant-azure/action/os_type.rb', line 17 def call(env) unless env[:machine].config.vm.guest env[:ui].info 'Determining OS Type By Image' guest_os_type = env[:azure_vm_service].send(:get_os_type, env[:machine].provider_config.vm_image) env[:machine].config.vm.guest = guest_os_type && guest_os_type.downcase.to_sym if env[:machine].config.vm.guest == :windows && env[:machine].config.vm.communicator.nil? env[:machine].config.vm.communicator = :winrm end env[:ui].info "OS Type is #{guest_os_type}" end @app.call(env) end |