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

Added support for entering namespaces using absolute paths#6

Merged
hjacobs merged 1 commit into
zalando:masterfrom
cnelson:setns-via-path
Jan 8, 2016
Merged

Added support for entering namespaces using absolute paths#6
hjacobs merged 1 commit into
zalando:masterfrom
cnelson:setns-via-path

Conversation

@cnelson

@cnelson cnelson commented Jan 7, 2016

Copy link
Copy Markdown

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

hjacobs commented Jan 8, 2016

Copy link
Copy Markdown
Contributor

👍 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

cnelson commented Jan 8, 2016

Copy link
Copy Markdown
Author

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