don't send core.dcos_acs_token to segment.io
This commit is contained in:
@@ -236,12 +236,15 @@ def _base_properties(conf=None, cluster_id=None):
|
||||
logger.exception('Unable to find the hostname of the cluster.')
|
||||
dcos_hostname = None
|
||||
|
||||
conf = [prop for prop in list(conf.property_items())
|
||||
if prop[0] != "core.dcos_acs_token"]
|
||||
|
||||
return {
|
||||
'cmd': cmd,
|
||||
'full_cmd': full_cmd,
|
||||
'dcoscli.version': dcoscli.version,
|
||||
'python_version': str(sys.version_info),
|
||||
'config': json.dumps(list(conf.property_items())),
|
||||
'config': json.dumps(conf),
|
||||
'DCOS_HOSTNAME': dcos_hostname,
|
||||
'CLUSTER_ID': cluster_id
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
[core]
|
||||
dcos_acs_token = "foobar"
|
||||
dcos_url = "https://dcos.snakeoil.mesosphere.com"
|
||||
email = "test@mail.com"
|
||||
reporting = true
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import os
|
||||
from functools import wraps
|
||||
|
||||
@@ -62,6 +63,21 @@ def test_cluster_id_not_sent_on_config_call():
|
||||
assert get_cluster_id.call_count == 0
|
||||
|
||||
|
||||
def test_dont_send_acs_token():
|
||||
"""Tests that we donn't send acs token"""
|
||||
|
||||
args = ['dcos', 'help']
|
||||
env = _env_reporting()
|
||||
version = 'release'
|
||||
|
||||
with patch('sys.argv', args), \
|
||||
patch.dict(os.environ, env), \
|
||||
patch('dcoscli.version', version):
|
||||
to_send = dcoscli.analytics._base_properties()
|
||||
config_to_send = json.loads(to_send.get("config"))
|
||||
assert "core.dcos_acs_token" not in config_to_send
|
||||
|
||||
|
||||
@_mock
|
||||
def test_no_exc():
|
||||
'''Tests that a command which does not raise an exception does not
|
||||
|
||||
Reference in New Issue
Block a user