예제 #1
0
def sysPing(ip, port=22):
    def cb(shprocess):
        return shprocess.exitCode == 0

    if ip == "":
        return False

    d = shLaunchDeferred("ping -c 1 '%s'" % ip)
    d.addCallback(cb)
    return d
예제 #2
0
파일: system.py 프로젝트: AnatomicJC/mmc
def sysPing(ip, port = 22):
    def cb(shprocess):
        return shprocess.exitCode == 0

    if ip == "":
         return False;

    d = shLaunchDeferred("ping -c 1 '%s'" % ip)
    d.addCallback(cb)
    return d
예제 #3
0
파일: smb_ldap.py 프로젝트: sebastiendu/mmc
    def makeSambaGroup(self, group):
        """
        Transform a POSIX group as a SAMBA group.
        It adds in the LDAP the necessary attributes to the group.

        @param group: the group name
        @type group: str

        @return: a deferred object resulting to the SAMBA net process exit code
        """
        r = AF().log(PLUGIN_NAME, AA.SAMBA_MAKE_SAMBA_GRP, [(group, AT.GROUP)])
        d = shLaunchDeferred(self._getMakeSambaGroupCommand(group))
        d.addCallback(lambda p: p.exitCode)
        r.commit()
        return d
예제 #4
0
def sysPing(ip, port=22):
    """
    This function all to ping machines. Default port is 22

    :param ip: IP of the machine to ping
    :param port: Port to ping ( default 22 )

    """
    def cb(shprocess):
        return shprocess.exitCode == 0

    if ip == "":
        return False

    d = shLaunchDeferred("ping -c 1 '%s'" % ip)
    d.addCallback(cb)
    return d