Class: Proxy::RemoteExecution::Ssh::MQTT
- Inherits:
-
Object
- Object
- Proxy::RemoteExecution::Ssh::MQTT
show all
- Defined in:
- lib/smart_proxy_remote_execution_ssh/mqtt/dispatcher.rb,
lib/smart_proxy_remote_execution_ssh/mqtt.rb
Defined Under Namespace
Classes: Dispatcher, DispatcherActor, DispatcherSupervisor
Class Method Summary
collapse
Class Method Details
.publish(topic, payload, retain: false, qos: 1) ⇒ Object
6
7
8
9
10
|
# File 'lib/smart_proxy_remote_execution_ssh/mqtt.rb', line 6
def publish(topic, payload, retain: false, qos: 1)
with_mqtt_client do |c|
c.publish(topic, payload, retain, qos)
end
end
|
.with_mqtt_client(&block) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/smart_proxy_remote_execution_ssh/mqtt.rb', line 12
def with_mqtt_client(&block)
::MQTT::Client.connect(Plugin.settings.mqtt_broker,
Plugin.settings.mqtt_port,
:ssl => Plugin.settings.mqtt_tls,
:cert_file => ::Proxy::SETTINGS.foreman_ssl_cert || ::Proxy::SETTINGS.ssl_certificate,
:key_file => ::Proxy::SETTINGS.foreman_ssl_key || ::Proxy::SETTINGS.ssl_private_key,
:ca_file => ::Proxy::SETTINGS.foreman_ssl_ca || ::Proxy::SETTINGS.ssl_ca_file,
&block)
end
|