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

Removes symlink/file PULP_DISTRIBUTION.xml before writing a new file #860

Merged
merged 1 commit into from May 2, 2016

Conversation

dkliban
Copy link
Member

@dkliban dkliban commented May 2, 2016

try:
os.remove(distribution_xml_path)
except OSError, e:
if e.errno == 2:
Copy link
Contributor

Choose a reason for hiding this comment

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

@dkliban dkliban force-pushed the 1869 branch 2 times, most recently from 8fe42f9 to 16f5ac4 Compare May 2, 2016 20:43
try:
os.remove(distribution_xml_path)
except OSError as e:
if e.errno == os.errno.ENOENT:
Copy link
Contributor

Choose a reason for hiding this comment

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

I would usually save a couple of lines and do the following, but it's no big deal.

if e.errno != os.errno.ENOENT:
    raise

@mhrivnak
Copy link
Contributor

mhrivnak commented May 2, 2016

LGTM, but I recommend at least one unit test that exercises the exception handling code, at least to cover the common case where the file doesn't exist.

@mhrivnak mhrivnak added the LGTM label May 2, 2016
@dkliban dkliban merged commit 29e1f23 into pulp:2.8-dev May 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants