Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion systemvm/debian/opt/cloud/bin/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def processCLItem(self, num, nw_type):
if('localgw' in self.qFile.data['cmd_line']):
dp['gateway'] = self.qFile.data['cmd_line']['localgw']
else:
dp['gateway'] = 'None'
dp['gateway'] = ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not use None instead of a empty string? Because None is the best way in Python to tell it's empty and does not contain anything.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes, or 'None' (in a string) I thought I commented that but cannot find my remarks.

@DaanHoogland DaanHoogland Aug 21, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah made it on the ticket instead of here #2805

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@wido later on code, there is a string literal concatenation, so if we use None (Type), will raise an "TypeError: cannot concatenate 'str' and 'NoneType' objects".

In python the '' also represent emptyness in if steatements, for this reason in this particular case i`ve used '' instead None (type) .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok, good point. So either this (less code) or a check on the gateway later to prevent the faulty concat. I can live with this solution. @wido?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm okay with the change.

dp['nic_dev_id'] = num
dp['nw_type'] = nw_type
qf = QueueFile()
Expand Down