def unshare_namespace(config_opts): base_unshare_flags = util.CLONE_NEWNS # IPC ns is unshared later extended_unshare_flags = base_unshare_flags | util.CLONE_NEWUTS try: util.unshare(extended_unshare_flags) except mockbuild.exception.UnshareFailed as e: log.debug("unshare(%d) failed, falling back to unshare(%d)", extended_unshare_flags, base_unshare_flags) try: util.unshare(base_unshare_flags) except mockbuild.exception.UnshareFailed as e: log.error("Namespace unshare failed.") if running_in_docker() and not ( 'docker_unshare_warning' in config_opts and config_opts['docker_unshare_warning']): log.error( "It seems we are running inside of Docker. Let skip unsharing." ) log.error( "You should *not* run anything but Mock in this container. You have been warned!" ) time.sleep(5) else: sys.exit(e.resultcode)
def unshare_namespace(): base_unshare_flags = util.CLONE_NEWNS # IPC ns is unshared later extended_unshare_flags = base_unshare_flags | util.CLONE_NEWUTS try: util.unshare(extended_unshare_flags) except mockbuild.exception.UnshareFailed as e: log.debug("unshare(%d) failed, falling back to unshare(%d)", extended_unshare_flags, base_unshare_flags) try: util.unshare(base_unshare_flags) except mockbuild.exception.UnshareFailed as e: log.error("Namespace unshare failed.") sys.exit(e.resultcode)
def unshare_namespace(): base_unshare_flags = util.CLONE_NEWNS # IPC ns is unshared later extended_unshare_flags = base_unshare_flags | util.CLONE_NEWUTS try: util.unshare(extended_unshare_flags) except mockbuild.exception.UnshareFailed as e: log.debug("unshare(%d) failed, falling back to unshare(%d)" % (extended_unshare_flags, base_unshare_flags)) try: util.unshare(base_unshare_flags) except mockbuild.exception.UnshareFailed as e: log.error("Namespace unshare failed.") sys.exit(e.resultcode)
def unshare_namespace(config_opts): base_unshare_flags = util.CLONE_NEWNS # IPC ns is unshared later extended_unshare_flags = base_unshare_flags | util.CLONE_NEWUTS try: util.unshare(extended_unshare_flags) except mockbuild.exception.UnshareFailed as e: log.debug("unshare(%d) failed, falling back to unshare(%d)", extended_unshare_flags, base_unshare_flags) try: util.unshare(base_unshare_flags) except mockbuild.exception.UnshareFailed as e: log.error("Namespace unshare failed.") if running_in_docker() and not ('docker_unshare_warning' in config_opts and config_opts['docker_unshare_warning']): log.error("It seems we are running inside of Docker. Let skip unsharing.") log.error("You should *not* run anything but Mock in this container. You have been warned!") time.sleep(5) else: sys.exit(e.resultcode)