Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ManageIQ/manageiq
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuldip-Nanda committed Sep 30, 2020
2 parents 20f06e3 + 5aea3d6 commit 30cdaf6
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/mailers/generic_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def set_mailer_smtp(evm_settings = nil)
else raise ArgumentError, "authentication value #{evm_settings[:authentication].inspect} must be one of: 'none', 'plain', 'login'"
end

OPTIONAL_SMTP_KEYS.each { |key| am_settings[key] = evm_settings[key] if evm_settings[key] }
OPTIONAL_SMTP_KEYS.each { |key| am_settings[key] = evm_settings[key] if evm_settings.key?(key) }

ActionMailer::Base.smtp_settings = am_settings
log_smtp_settings = am_settings.dup
Expand Down
2 changes: 2 additions & 0 deletions app/models/configuration_profile.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class ConfigurationProfile < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin

acts_as_miq_taggable
belongs_to :manager, :class_name => 'ExtManagementSystem'
belongs_to :parent, :class_name => 'ConfigurationProfile'
Expand Down
2 changes: 2 additions & 0 deletions app/models/configured_system.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class ConfiguredSystem < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin

acts_as_miq_taggable
belongs_to :configuration_location
belongs_to :configuration_organization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ class ManageIQ::Providers::CloudManager::ProvisionWorkflow < ::MiqProvisionVirtW
include CloudInitTemplateMixin
include SysprepTemplateMixin

def volume_dialog_keys
%i[name size delete_on_terminate]
end

def allowed_availability_zones(_options = {})
source = load_ar_obj(get_source_vm)
targets = get_targets_for_ems(source, :cloud_filter, AvailabilityZone, 'availability_zones.available')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ def sync
configuration_script_payloads.reload
end
update!(:status => "successful",
:last_updated_on => Time.zone.now,
:last_update_error => nil)
:last_updated_on => Time.zone.now,
:last_update_error => nil)
rescue => error
update!(:status => "error",
:last_updated_on => Time.zone.now,
:last_update_error => format_sync_error(error))
:last_updated_on => Time.zone.now,
:last_update_error => format_sync_error(error))
raise error
end

Expand Down
5 changes: 3 additions & 2 deletions lib/remote_console/client_adapter/web_mks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ def fetch(length)
# This callback should be set just once, yielding with the parsed message
@driver.on(:message) { |msg| yield(msg.data) } if @driver.listeners(:message).length.zero?

data = @ssl.sysread(length) # Read from the socket
@driver.parse(data) # Parse the incoming data, run the callback from above
data = @ssl.send(:sysread_nonblock, length, :exception => false)
# Parse the incoming data, run the callback from above
@driver.parse(data) if data != :wait_readable
end

def issue(data)
Expand Down
7 changes: 5 additions & 2 deletions lib/remote_console/rack_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ def init_proxy(env, secret)
ws_sock = env['rack.hijack'].call # Hijack the socket from the incoming HTTP connection
console_sock = TCPSocket.open(record.host_name, record.port) # Open a TCP connection to the remote endpoint

ws_sock.autoclose = false
console_sock.autoclose = false

# These adapters will be used for reading/writing from/to the particular sockets
@adapters[console_sock] = ClientAdapter.new(record, console_sock)
@adapters[ws_sock] = ServerAdapter.new(record, env, ws_sock)
Expand All @@ -108,13 +111,13 @@ def cleanup(log_level, message, sock_a, sock_b, record = nil)
@logger.send(log_level, message % {:vm_id => record.vm_id})
end

@proxy.pop(sock_a, sock_b) unless sock_a.nil? || sock_b.nil?

# Close the sockets if they aren't closed yet
[sock_a, sock_b].each do |sock|
sock.try(:close)
@adapters.delete(sock)
end

@proxy.pop(sock_a, sock_b) unless sock_a.nil? || sock_b.nil?
end

# Primitive same-origin policy checking in production
Expand Down
8 changes: 8 additions & 0 deletions spec/mailers/generic_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,12 @@
it "returns an array of openssl verify modes" do
expect(GenericMailer.openssl_verify_modes).to eq([["None", "none"], ["Peer", "peer"], ["Client Once", "client_once"], ["Fail If No Peer Cert", "fail_if_no_peer_cert"]])
end

it "sets optional smtp keys as expected" do
mail = GenericMailer.new
options = {:enable_starttls_auto => false, :openssl_verify_mode => :none}
mail.send(:set_mailer_smtp, options)
options.delete(:authentication) # Deal with current pass by ref issue
expect(ActionMailer::Base.smtp_settings).to include(options)
end
end

0 comments on commit 30cdaf6

Please sign in to comment.