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

Minor improves, mainly typos and comments #124

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions xcp/net/ifrename/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def load_and_parse(self):
if len(l.strip()) and l.strip()[0] != '#' ]
)

# If the data is empty, dont pass it to json
# If the data is empty, don't pass it to json
if not len( data.strip() ):
return True

Expand Down Expand Up @@ -238,7 +238,6 @@ def generate(self, state):

LOG.critical("Unknown dynamic rule method %s" % method)


def write(self, header = True):
"""
Write the dynamic rules to a string
Expand Down
6 changes: 3 additions & 3 deletions xcp/net/ifrename/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __rename_nic(nic, name, transactions, cur_state):
else:
# Another nic is in the way for applying the rule. Move it sideways

# Old comment from 2012: given new assertions, will this ever be nessesary?
# Old comment from 2012: given new assertions, will this ever be necessary?
if aliased.kname[:5] == "side-":
aliased_eth = aliased.kname.split('-')[2]
else:
Expand Down Expand Up @@ -371,7 +371,7 @@ def rename( static_rules,
old_state ):
"""
Rename current state based on the rules and past state.
This function sanitises the input and delgates the renaming logic to
This function sanitises the input and delegates the renaming logic to
__rename.
@param static_rules
List of MACPCI objects representing rules
Expand All @@ -384,7 +384,7 @@ def rename( static_rules,

@throws StaticRuleError, CurrentStateError, LastStateError, TypeError

@returns list of tuples of name changes requred
@returns list of tuples of name changes required
"""

if len(static_rules):
Expand Down
2 changes: 1 addition & 1 deletion xcp/net/ifrename/macpci.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"""
MACPCI object.

Used extensivly for interface rename logic.
Used extensively for interface rename logic.
"""

__version__ = "1.0.1"
Expand Down
9 changes: 8 additions & 1 deletion xcp/net/ifrename/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ def generate(self, state):
LOG.critical("Unknown static rule method %s" % method)

def write(self, header = True):
"""
Write the static rules to a string
"""

res = ""

Expand Down Expand Up @@ -320,6 +323,10 @@ def write(self, header = True):
return res

def save(self, header = True):
"""
Save the static rules to a file/path.
Returns boolean indicating success or failure.
"""

fd = None

Expand All @@ -330,7 +337,7 @@ def save(self, header = True):
fd = open_with_codec_handling(self.path, "w")
fd.write(self.write(header))

# else if we were given a file descriptor, just read it
# else if we were given a file descriptor, just write to it
elif self.fd:
self.fd.write(self.write(header))

Expand Down
4 changes: 2 additions & 2 deletions xcp/net/ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def ip_link_set_name(src_name, dst_name):
if isup:

# Performace note: if we are doing an intermediate rename to
# move a device sideways, we shouldnt bring it back until it has
# its final name. However, i cant think of a non-hacky way of doing
# move a device sideways, we shouldn't bring it back until it has
# its final name. However, I can't think of a non-hacky way of doing
# this with the current implementation

link_up = Popen(["ip", "link", "set", dst_name, "up"], universal_newlines=True)
Expand Down
Loading