Skip to content

Commit 824ace0

Browse files
Only generate MQTT credentials if command is compile or run.
1 parent 200f669 commit 824ace0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@ venv.bak/
103103
# mypy
104104
.mypy_cache/
105105

106-
config/
106+
config
107107
tests/build/
108108
tests/.esphomeyaml/

esphomeyaml/yaml_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def _gen_device_name(loader, node):
280280

281281
def _gen_mqtt_username(loader, node):
282282
return _gen_device_name(loader, node)
283-
283+
284284
def _gen_mqtt_password(loader, node):
285285
client = paho.mqtt.client.Client(client_id='esphomeyaml', clean_session=False)
286286
client.username_pw_set(os.environ['MQTT_USERNAME'],os.environ['MQTT_PASSWORD'] )
@@ -291,7 +291,7 @@ def _gen_mqtt_password(loader, node):
291291
client.connect(host='mqtt', port=8883)
292292

293293
hal_mqtt_username = _gen_device_name(loader, node)
294-
if SafeLineLoader.command != "config":
294+
if SafeLineLoader.command in ["compile", "run"]:
295295
vault_client = hvac.Client(url='https://vault:8200', token=os.environ['VAULT_TOKEN'], verify='ca')
296296
vault_client.token = os.environ['VAULT_TOKEN']
297297
hal_mqtt_password = vault_client.write("sys/tools/random/16")['data']['random_bytes']

0 commit comments

Comments
 (0)