Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): properly parse escaped nmcli responses #5246

Merged
merged 1 commit into from
Mar 18, 2020

Conversation

sfoster1
Copy link
Member

nmcli uses ':' as a field separator. If it encounters a : in a field
value, it escapes it with a backslash. We weren't parsing this
correctly (or indeed at all) and therefore couldn't connect to wifi
networks whose names include a colon. Parsing escaped strings is hard,
so this change uses the csv module to parse them properly

Testing

  • Connect to a wifi network. I did this at home (my network has a colon in it, hence the issue) and it works now

Risk assessment

  • Really only new wifi connections, and since it's only response values even just listing wifi networks checks if the problem is solved

nmcli uses ':' as a field separator. If it encounters a : in a field
value, it escapes it with a backslash. We weren't parsing this
correctly (or indeed at all) and therefore couldn't connect to wifi
networks whose names include a colon. Parsing escaped strings is hard,
so this change uses the csv module to parse them properly
@sfoster1 sfoster1 added api Affects the `api` project fix PR fixes a bug labels Mar 18, 2020
@sfoster1 sfoster1 requested review from a team, amitlissack and sanni-t and removed request for a team March 18, 2020 14:12
Copy link
Contributor

@amitlissack amitlissack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@codecov
Copy link

codecov bot commented Mar 18, 2020

Codecov Report

Merging #5246 into edge will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             edge    #5246      +/-   ##
==========================================
- Coverage   61.16%   61.16%   -0.01%     
==========================================
  Files        1032     1032              
  Lines       29403    29407       +4     
==========================================
+ Hits        17984    17986       +2     
- Misses      11419    11421       +2     
Impacted Files Coverage Δ
opentrons/system/nmcli.py 51.82% <0.00%> (-0.03%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e7ecaf6...b7bae7e. Read the comment docs.

@sfoster1 sfoster1 merged commit 91178f0 into edge Mar 18, 2020
@sfoster1 sfoster1 deleted the api_fix-nmcli-response-escaping branch March 18, 2020 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Affects the `api` project fix PR fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants