Skip to content

Commit df6683c

Browse files
hotfix for AzureIoTEdgeV2 2.4.7 (#14737)
Co-authored-by: Cindy Deng <[email protected]>
1 parent 3a17c28 commit df6683c

File tree

6 files changed

+41
-15
lines changed

6 files changed

+41
-15
lines changed

Tasks/AzureIoTEdgeV2/constant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ export default class Constants {
2828
public static defaultExecOption = {} as IExecSyncOptions;
2929
public static UTF8 = "utf8";
3030
public static outputVariableDeploymentPathKey = "DEPLOYMENT_FILE_PATH";
31-
public static azureCliIotExtensionDefaultSource = "https://github.com/Azure/azure-iot-cli-extension/releases/download/v0.9.0/azure_iot-0.9.0-py2.py3-none-any.whl";
31+
public static azureCliIotExtensionDefaultSource = "https://github.com/Azure/azure-iot-cli-extension/releases/download/v0.10.10/azure_iot-0.10.10-py3-none-any.whl";
3232
}

Tasks/AzureIoTEdgeV2/deployimage.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class azureclitask {
4343

4444
this.loginAzure();
4545

46-
tl.debug('OS release:' + os.release());
47-
46+
tl.debug('OS release:' + os.release());
4847
let showIotExtensionCommand = ["extension", "show", "--name", "azure-iot"];
4948
let result = tl.execSync('az', showIotExtensionCommand, Constants.execSyncSilentOption);
5049
if (result.code !== 0) { // The extension is not installed
@@ -111,6 +110,32 @@ class azureclitask {
111110
}
112111

113112
static installAzureCliIotExtension(installCommand: string[]) {
113+
let outputStream: EchoStream = new EchoStream();
114+
let execOptions: IExecOptions = {
115+
errStream: outputStream as stream.Writable
116+
} as IExecOptions;
117+
118+
// check azcli version
119+
let checkAzureIoTVersionExtensionCommand = ["--version"];
120+
let viewAzVersionResult = tl.execSync('az', checkAzureIoTVersionExtensionCommand, execOptions);
121+
if(viewAzVersionResult.code !== 0)
122+
{
123+
throw new Error(`View Az Version Error: ${outputStream.content}`);
124+
}
125+
126+
// upgrade setuptools in azcli's private python environment to avoid conflict when installing azure-iot extension
127+
// temporary solution until the paho-mqtt error in win2016 goes away
128+
if(tl.osType() === Constants.osTypeWindows)
129+
{
130+
let pythonExeLocation : string = 'C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\python.exe';
131+
let setupToolsInstallationCommand = ['-m', 'pip', 'install', '-U', 'setuptools==52.0.0'];
132+
let upgradeSetuptoolsResult = tl.execSync(pythonExeLocation, setupToolsInstallationCommand, execOptions);
133+
if(upgradeSetuptoolsResult.code !== 0)
134+
{
135+
throw new Error(`Upgrade setuptools Error: ${outputStream.content}`);
136+
}
137+
}
138+
114139
let addResult = tl.execSync('az', installCommand, Constants.execSyncSilentOption);
115140
tl.debug(JSON.stringify(addResult));
116141
if (addResult.code !== 0) {

Tasks/AzureIoTEdgeV2/package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/AzureIoTEdgeV2/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 2,
1616
"Minor": 4,
17-
"Patch": 6
17+
"Patch": 7
1818
},
1919
"preview": false,
2020
"showEnvironmentVariables": true,

Tasks/AzureIoTEdgeV2/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 2,
1616
"Minor": 4,
17-
"Patch": 6
17+
"Patch": 7
1818
},
1919
"preview": false,
2020
"showEnvironmentVariables": true,

Tasks/AzureIoTEdgeV2/util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ export default class Util {
8888
if (tl.osType() === Constants.osTypeLinux) {
8989
cmds = [
9090
{ path: `sudo`, arg: `apt-get update`, execOption: Constants.execSyncSilentOption },
91+
{ path: `sudo`, arg: `-H pip3 install wheel --upgrade`, execOption: Constants.execSyncSilentOption },
92+
{ path: `sudo`, arg: `pip3 install importlib-metadata==2.1.1`, execOption: Constants.execSyncSilentOption },
9193
{ path: `sudo`, arg: `apt-get install -y python3-setuptools`, execOption: Constants.execSyncSilentOption },
92-
{ path: `sudo`, arg: `pip install --upgrade cryptography`, execOption: Constants.execSyncSilentOption},
9394
{ path: `sudo`, arg: `pip3 install ${Constants.iotedgedev}~=${version}`, execOption: Constants.execSyncSilentOption },
9495
]
9596
} else if (tl.osType() === Constants.osTypeWindows) {

0 commit comments

Comments
 (0)