Azure / Azure/azure-iot-cli-extension
'az iot central device command run' Throws Internal Error
- Dominant language
- Python
- Stars
- 88
- Forks
- 78
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 9
Description
## Describe the bug
Trying to run the GetModuleLogs command on an IoT Central device throws an exception. See the trace below.
**Command Name**
`az iot central device command run
Extension Name: azure-iot. Version: 0.10.11.`
**Errors:**
```
[Errno 2] No such file or directory: '\\'
Traceback (most recent call last):
Temp\pip-unpacked-wheel-rpp6y7vh\knack\cli.py, ln 215, in invoke
cli\core\commands\__init__.py, ln 659, in execute
cli\core\commands\__init__.py, ln 722, in _run_jobs_serially
cli\core\commands\__init__.py, ln 715, in _run_job
Local\Temp\pip-unpacked-wheel-igh1xymj\six.py, ln 703, in reraise
cli\core\commands\__init__.py, ln 693, in _run_job
cli\core\commands\__init__.py, ln 330, in __call__
...
content = read_file_content(content)
azure-iot\azext_iot\common\utility.py, ln 174, in read_file_content
with codecs_open(file_path, encoding=encoding) as f:
codecs.py, ln 897, in open
FileNotFoundError: [Errno 2] No such file or directory: '\\'
```
## To Reproduce:
- Run the following command, replacing appid, deviceid, and interfaceid with values for your solution:
````
az iot central device command run -n {appid} -d {deviceid} -i {interfaceid} --cn 'GetModuleLogs' -k \
'{
"schemaVersion": "1.0",
"items": [
{
"id": "$edgeAgent",
"filter": {
"tail": 10
}
}
],
"encoding": "none",
"contentType": "text"
}'
````
## Expected Behavior
This command should return the logs from the module.
## Environment Summary
```
Windows-10-10.0.19041-SP0
Python 3.6.8
Installer: MSI
azure-cli 2.17.1 *
Extensions:
azure-iot 0.10.11
```
## Additional Context
Contributor guide
Research direction
Run the reproduced `az iot central device command run` command on Windows, then inspect `azure-iot/azext_iot/common/utility.py`, especially `read_file_content` at the traceback location. Trace how the command content reaches that entry point; done means the GetModuleLogs command returns the module logs instead of raising FileNotFoundError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- cli, cloud, embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100