コード例 #1
0
ファイル: docker.py プロジェクト: takluyver/subuser
def getDockerExecutable():
  """ Return the name of the docker executable or None if docker is not installed. """
  if executablePath.which("docker.io"): # Docker is called docker.io on debian.
    return "docker.io"
  if executablePath.which("docker"):
    return "docker"
  return None
コード例 #2
0
ファイル: docker.py プロジェクト: jig/subuser
def getDockerExecutable():
    """ Return the name of the docker executable. Exits and displays a user friendly error message if docker is not setup correctly. """
    if executablePath.which("docker.io"):  # Docker is called docker.io on debian.
        return "docker.io"
    if executablePath.which("docker"):
        return "docker"
    sys.exit(
        """Error: Docker is not installed.

For instalation instructions see <https://www.docker.io/gettingstarted/#h_installation>"""
    )
    if not os.path.exists("/var/run/docker.pid"):
        sys.exit(
            """Error: Docker is not running.  You can launch it as root with:

# docker -d
"""
        )

    username = getpass.getuser()
    if not username in grp.getgrnam("docker").gr_mem:
        sys.exit(
            """Error: You are not a member of the docker group.

To learn how to become a member of the docker group please watch this video: <http://www.youtube.com/watch?v=ahgRx5U4V7E>"""
        )
コード例 #3
0
ファイル: commands.py プロジェクト: inthecloud247/subuser
def getSubuserCommandPath(command):
  builtInCommandPath = os.path.join(_getSubuserCommandsPath(),command)
  if os.path.exists(builtInCommandPath):
    return builtInCommandPath
  else:
    externalCommandPath = executablePath.which("subuser-"+command)
    return externalCommandPath
コード例 #4
0
def getSubuserCommandPath(command):
  builtInCommandPath = os.path.join(paths.getSubuserCommandsDir(),command)
  if os.path.exists(builtInCommandPath):
    return builtInCommandPath
  else:
    externalCommandPath = executablePath.which("subuser-"+command)
    return externalCommandPath
コード例 #5
0
ファイル: commands.py プロジェクト: marclaporte/subuser
def getSubuserCommandPath(command):
  builtInCommandPath = os.path.join(paths.getSubuserCommandsDir(),command)
  if os.path.exists(builtInCommandPath):
    return builtInCommandPath
  elif os.path.exists(builtInCommandPath+".py"):

    return (builtInCommandPath+".py")
  else:
    externalCommandPath = executablePath.which("subuser-"+command)
    return externalCommandPath
コード例 #6
0
def getDockerExecutable():
    """ Return the name of the docker executable. Exits and displays a user friendly error message if docker is not setup correctly. """
    if executablePath.which(
            "docker.io"):  # Docker is called docker.io on debian.
        return "docker.io"
    if executablePath.which("docker"):
        return "docker"
    sys.exit("""Error: Docker is not installed.

For instalation instructions see <https://www.docker.io/gettingstarted/#h_installation>"""
             )
    if not os.path.exists("/var/run/docker.pid"):
        sys.exit(
            """Error: Docker is not running.  You can launch it as root with:

# docker -d
""")

    username = getpass.getuser()
    if not username in grp.getgrnam("docker").gr_mem:
        sys.exit("""Error: You are not a member of the docker group.

To learn how to become a member of the docker group please watch this video: <http://www.youtube.com/watch?v=ahgRx5U4V7E>"""
                 )