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
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
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
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