зеркало из https://github.com/Azure/iotedgedev.git
handle dps string
This commit is contained in:
Родитель
917123c827
Коммит
9d1a58ebd0
|
@ -2,5 +2,5 @@
|
|||
|
||||
__author__ = 'Microsoft Corporation'
|
||||
__email__ = 'opencode@microsoft.com'
|
||||
__version__ = '3.2.0'
|
||||
__version__ = '3.2.1rc0'
|
||||
__AIkey__ = '95b20d64-f54f-4de3-8ad5-165a75a6c6fe'
|
|
@ -16,8 +16,13 @@ class ConnectionString:
|
|||
|
||||
if self.data:
|
||||
self.iothub_host = IoTHubHost(self["hostname"])
|
||||
self.shared_access_key = self["sharedaccesskey"]
|
||||
|
||||
self.shared_access_key = None
|
||||
if("sharedaccesskey" in self.data):
|
||||
self.shared_access_key = self["sharedaccesskey"]
|
||||
else:
|
||||
# unexpected input of connection. Set to None and throw error
|
||||
self.connection_string = None
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.data[key]
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ class EnvVars:
|
|||
self.IOTHUB_CONNECTION_INFO = None
|
||||
if self.IOTHUB_CONNECTION_STRING:
|
||||
self.IOTHUB_CONNECTION_INFO = IoTHubConnectionString(self.IOTHUB_CONNECTION_STRING)
|
||||
if(not self.IOTHUB_CONNECTION_INFO.connection_string):
|
||||
self.output.error("iotedgedev currently does not recognize non-SAS connection strings. Will be setting connection string as empty.")
|
||||
|
||||
except Exception as ex:
|
||||
raise ValueError("Unable to parse IOTHUB_CONNECTION_STRING Environment Variable. Please ensure that you have the right connection string set. {0}".format(str(ex)))
|
||||
|
@ -90,6 +92,8 @@ class EnvVars:
|
|||
self.DEVICE_CONNECTION_INFO = None
|
||||
if self.DEVICE_CONNECTION_STRING:
|
||||
self.DEVICE_CONNECTION_INFO = DeviceConnectionString(self.DEVICE_CONNECTION_STRING)
|
||||
if(not self.DEVICE_CONNECTION_INFO.connection_string):
|
||||
self.output.error("iotedgedev currently does not recognize non-SAS connection strings. Will be setting connection string as empty.")
|
||||
|
||||
except Exception as ex:
|
||||
raise ValueError("Unable to parse DEVICE_CONNECTION_STRING Environment Variable. Please ensure that you have the right connection string set. {0}".format(str(ex)))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[bumpversion]
|
||||
current_version = 3.2.0
|
||||
current_version = 3.2.1rc0
|
||||
commit = True
|
||||
tag = True
|
||||
|
||||
|
|
2
setup.py
2
setup.py
|
@ -31,7 +31,7 @@ test_requirements = [
|
|||
|
||||
setup(
|
||||
name='iotedgedev',
|
||||
version='3.2.0',
|
||||
version='3.2.1rc0',
|
||||
description='The Azure IoT Edge Dev Tool greatly simplifies the IoT Edge development process by automating many routine manual tasks, such as building, deploying, pushing modules and configuring the IoT Edge Runtime.',
|
||||
long_description='See https://github.com/azure/iotedgedev for usage instructions.',
|
||||
author='Microsoft Corporation',
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
__author__ = 'Microsoft Corporation'
|
||||
__email__ = 'opencode@microsoft.com'
|
||||
__version__ = '3.2.0'
|
||||
__version__ = '3.2.1rc0'
|
||||
|
|
|
@ -14,6 +14,12 @@ invalid_connectionstring = "HostName=azure-devices.net;SharedAccessKey=gibberish
|
|||
invalid_iothub_connectionstring = "HostName=testhub.azure-devices.net;SharedAccessKey=moregibberish"
|
||||
invalid_device_connectionstring = "HostName=testhub.azure-devices.net;DeviceId=;SharedAccessKey=othergibberish"
|
||||
empty_hostname_iothub_connectionstring = "HostName=;SharedAccessKeyName=iothubowner;SharedAccessKey=moregibberish"
|
||||
non_sas_connectionstring = "HostName=testhub.azure-devices.net;DeviceId=testdevice;x509=true"
|
||||
|
||||
|
||||
def test_non_sas_connectionstring():
|
||||
connStr = ConnectionString(non_sas_connectionstring)
|
||||
assert not connStr.connection_string
|
||||
|
||||
|
||||
def test_empty_connectionstring():
|
||||
|
|
Загрузка…
Ссылка в новой задаче