fixes mqtt docker start procedure

This commit is contained in:
Ronald Steinke 2018-06-18 14:51:34 +02:00
parent 3c11330c22
commit 71e6b5c175
5 changed files with 27 additions and 25 deletions

View File

@ -16,8 +16,9 @@
"topic_index_location": 1,
"topic_index_device": -1,
"fiware_service": null,
"broker_user": "foo",
"broker_user_pw": "bar",
"broker_user": "",
"broker_user_pw": "",
"mqtts_enabled": false,
"mqtts_ca_certs": null,
"mqtts_certfile": null,
"mqtts_keyfile": null,

View File

@ -12,11 +12,12 @@ SSL_KEY=${SSL_KEY-"/etc/openmtc/certs/mqttconnector.key.pem"}
SSL_CA=${SSL_CA-"/etc/openmtc/certs/ca-chain.cert.pem"}
BROKER_EP=${BROKER_EP-"localhost:1883"}
TOPIC_PRE=${TOPIC_PRE-"exampleTopic"}
TOPIC_INDEX_LOCATION=${TOPIC_INDEX_LOCATION}
TOPIC_INDEX_DEVICE=${TOPIC_INDEX_DEVICE}
TOPIC_INDEX_LOCATION=${TOPIC_INDEX_LOCATION-1}
TOPIC_INDEX_DEVICE=${TOPIC_INDEX_DEVICE:-1}
FIWARE_SERVICE=${FIWARE_SERVICE}
BROKER_USER=${BROKER_USER-"foo"}
BROKER_USER_PW=${BROKER_USER_PW-"bar"}
BROKER_USER=${BROKER_USER-""}
BROKER_USER_PW=${BROKER_USER_PW-""}
MQTTS_ENABLED=${MQTTS_ENABLED-false}
MQTTS_CA_CERTS=${MQTTS_CA_CERTS}
MQTTS_CERTFILE=${MQTTS_CERTFILE}
MQTTS_KEYFILE=${MQTTS_KEYFILE}
@ -62,6 +63,7 @@ JQ_STRING=${JQ_STRING}' |
.fiware_service = "'${FIWARE_SERVICE}'" |
.broker_user = "'${BROKER_USER}'" |
.broker_user_pw = "'${BROKER_USER_PW}'" |
.mqtts_enabled = '${MQTTS_ENABLED}' |
.mqtts_ca_certs = "'${MQTTS_CA_CERTS}'" |
.mqtts_certfile = "'${MQTTS_CERTFILE}'" |
.mqtts_keyfile = "'${MQTTS_KEYFILE}'" |

View File

@ -16,8 +16,9 @@
"topic_index_location": 1,
"topic_index_device": -1,
"fiware_service": null,
"broker_user": "foo",
"broker_user_pw": "bar",
"broker_user": "",
"broker_user_pw": "",
"mqtts_enabled": false,
"mqtts_ca_certs": null,
"mqtts_certfile": null,
"mqtts_keyfile": null,

View File

@ -11,8 +11,8 @@ default_topic_pre = "exampleTopic"
default_topic_index_location = 1
default_topic_index_device = -1
default_fiware_service = None
default_broker_user = "foo"
default_broker_user_pw = "bar"
default_broker_user = ""
default_broker_user_pw = ""
default_mqtts_ca_certs = None
default_mqtts_certfile = None
default_mqtts_keyfile = None
@ -24,20 +24,18 @@ parser = ArgumentParser(
formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument("-n", "--name", help="Name used for the AE.")
parser.add_argument("-s", "--ep", help="URL of the local Endpoint.")
parser.add_argument("--topic_pre", help="Topic you want to be subscribed to")
parser.add_argument("--topic-pre", help="Topic you want to be subscribed to")
parser.add_argument(
"--topic_index_location", help="Index of location in topic string")
"--topic-index-location", help="Index of location in topic string")
parser.add_argument(
"--topic_index_device", help="Index of device name in topic string")
parser.add_argument("--broker_user", help="credentials for MQTT broker")
parser.add_argument("--broker_user_pw", help="credentials for MQTT broker")
parser.add_argument("--mqtts", dest='mqtts_enabled', action='store_true')
parser.add_argument("--no-mqtts", dest='mqtts_enabled', action='store_false')
parser.set_defaults(mqtts_enabled=False)
"--topic-index-device", help="Index of device name in topic string")
parser.add_argument("--broker-user", help="credentials for MQTT broker")
parser.add_argument("--broker-user-pw", help="credentials for MQTT broker")
parser.add_argument("--mqtts-enabled", action='store_true')
parser.add_argument(
"--mqtts_ca_certs", help="Path to CA certs or tuple of paths")
parser.add_argument("--mqtts_certfile", help="Path to own mqtts cert")
parser.add_argument("--mqtts_keyfile", help="Path to own mqtts key")
"--mqtts-ca-certs", help="Path to CA certs or tuple of paths")
parser.add_argument("--mqtts-certfile", help="Path to own mqtts cert")
parser.add_argument("--mqtts-keyfile", help="Path to own mqtts key")
# args, config and logging
args, config = prepare_app(parser, __loader__, __name__, "config.json")
@ -49,7 +47,7 @@ poas = config.get("poas", ["http://auto:21753"])
originator_pre = config.get("originator_pre", "//openmtc.org/mn-cse-1")
ssl_certs = config.get("ssl_certs", {})
broker_ep = config.get("broker_ep", "openmtc.smartorchestra.de:8883")
broker_ep = config.get("broker_ep", "localhost:8883")
topic_pre = get_value("topic_pre", (unicode, str), default_topic_pre, args,
config)

View File

@ -41,9 +41,9 @@ class mqttConnector(XAE):
self.broker_user = broker_user
self.broker_user_pw = broker_user_pw
self.mqtts_enabled = mqtts_enabled
self.mqtts_ca_certs = mqtts_ca_certs
self.mqtts_certfile = mqtts_certfile
self.mqtts_keyfile = mqtts_keyfile
self.mqtts_ca_certs = mqtts_ca_certs or None
self.mqtts_certfile = mqtts_certfile or None
self.mqtts_keyfile = mqtts_keyfile or None
super(mqttConnector, self).__init__(*args, **kw)