Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Added support for entering namespaces using absolute paths #6

Merged
merged 1 commit into from
Jan 8, 2016

Conversation

cnelson
Copy link

@cnelson cnelson commented Jan 7, 2016

Allows for specifying a full path to a file which represents a namespace rather than a pid.

This is intended to support entering namespaces created with other tools like ip netns add

The Interface is unchanged, you specify a path instead of a numeric pid as the first positional param to the context manager:

with Namespace('/var/run/netns/foo', 'net'):
    pass

Fixes #5

@hjacobs
Copy link
Contributor

hjacobs commented Jan 8, 2016

👍 there might be better/smarter/cleaner solutions (I guess), but I think that's good enough and solves the problem 😄

hjacobs added a commit that referenced this pull request Jan 8, 2016
Added support for entering namespaces using absolute paths
@hjacobs hjacobs merged commit e75de61 into zalando:master Jan 8, 2016
@cnelson
Copy link
Author

cnelson commented Jan 8, 2016

At some point it'd probably be a good idea to add the CLONE_NEW* constants and stop passing 0 as the nstype when calling setns() so we are absolutely sure they are entering the namespace type they requested.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants