def setupReplica(self, args): """Set default replia credentials """ args.setdefault('binddn', REPLBINDDN) args.setdefault('bindpw', REPLBINDPW) # manage a progressive REPLICAID args.setdefault('id', get_next_replicaid(args.get('id'), args.get('type'))) return DSAdmin.setupReplica(self, args)
def setupBackend(self, suffix, binddn=None, bindpw=None, urls=None, attrvals=None, benamebase=None, verbose=False): """Create a backends using the first available cn.""" # if benamebase is set, try creating without appending if benamebase: benum = 0 else: benum = 1 # figure out what type of be based on args if binddn and bindpw and urls: # its a chaining be benamebase = benamebase or "chaindb" else: # its a ldbm be benamebase = benamebase or "localdb" done = False while not done: # if benamebase is set, benum starts at 0 # and the first attempt tries to create the # simple benamebase. On failure benum is # incremented and the suffix is appended # to the cn if benum: benamebase_tmp = benamebase + str(benum) # e.g. localdb1 else: benamebase_tmp = benamebase try: cn = DSAdmin.setupBackend(suffix, binddn, bindpw, urls, attrvals, benamebase, verbose) done = True except ldap.ALREADY_EXISTS: benum += 1 return cn
"suffix": basedn, "bename": "userRoot", "binddn": "cn=replrepl,cn=config", "bindcn": "replrepl", "bindpw": "replrepl", "pd": 5, "log": False, } m2replargs = m1replargs m1 = DSAdmin.createInstance( { "newrootpw": "password", "newhost": host1, "newport": port1, "newinst": "m1", "newsuffix": basedn, "verbose": True, "no_admin": True, } ) # os.environ['USE_GDB'] = "1" m2 = DSAdmin.createInstance( { "newrootpw": "password", "newhost": host2, "newport": port2, "newinst": "m2", "newsuffix": basedn, "verbose": False,
#os.environ['USE_DBX'] = "1" m1replargs = { 'suffix': "dc=example,dc=com", 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'chain': True } m1 = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': 'dc=example,dc=com', 'verbose': True, 'no_admin': True }) #del os.environ['USE_DBX'] print "Set the cache size really low" replace = [(ldap.MOD_REPLACE, 'nsslapd-cachememsize', '500000')] m1.modify_s('cn=userRoot,cn=ldbm database,cn=plugins,cn=config', replace) print "restart the server to force cache size change to take effect" m1.stop(True) m1.start(True) time.sleep(1)
def setupBindDN(self, binddn=REPLBINDDN, bindpw=REPLBINDPW): return DSAdmin.setupBindDN(self, binddn, bindpw)
import ldap import ldapurl import ldif import pprint host1 = "localhost.localdomain" if len(sys.argv) > 1: host1 = sys.argv[1] port1 = 1200 basedn = 'dc=example,dc=com' #os.environ['USE_GDB'] = "1" srv = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'srv', 'newsuffix': basedn, 'no_admin': True }) #del os.environ['USE_GDB'] val1 = 'PRC (China)Limited company' val2 = 'PRC (China) Limited company' rdn1 = "ou=" + val1 rdn2 = "ou=" + val2 filt1 = '(ou=*\\28China\\29Limited*)' filt2 = '(ou=*\\28China\\29*)' filt3 = '(businessCategory=*\\29Limited*)' dn1 = rdn1 + "," + basedn dn2 = rdn2 + "," + basedn
import os import ldap host1 = "localhost.localdomain" host2 = host1 cfgport = 1100 port1 = cfgport + 30 port2 = port1 + 10 #os.environ['USE_DBX'] = "1" m1 = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': 'dc=example,dc=com', 'verbose': True, 'no_admin': True }) #del os.environ['USE_DBX'] initfile = '' if os.environ.has_key('SERVER_ROOT'): initfile = "%s/slapd-%s/ldif/Example.ldif" % (m1.sroot, m1.inst) else: initfile = "%s/share/dirsrv/data/Example.ldif" % os.environ.get( 'PREFIX', '/usr') m1.importLDIF(initfile, '', "userRoot", True)
'suffix': basedn, 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'starttls': True, 'log': False } m2replargs = m1replargs os.environ['USE_VALGRIND'] = "1" m1 = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': basedn, 'verbose': False, 'no_admin': True }) del os.environ['USE_VALGRIND'] m2 = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host2, 'newport': port2, 'newinst': 'm2', 'newsuffix': basedn, 'verbose': False, 'no_admin': True })
secport2 = port2 + 1 basedn = "dc=example,dc=com" binddn = "cn=directory manager" bindpw = "password" #basedn = "dc=testdomain,dc=com" #host1 = 'el4i386' #port1 = 389 #m1 = DSAdmin(host1, port1, binddn, bindpw) #os.environ['USE_VALGRIND'] = "1" m1 = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': basedn, 'verbose': False, 'no_admin': True }) #del os.environ['USE_VALGRIND'] # initfile = '' # if os.environ.has_key('SERVER_ROOT'): # initfile = "%s/slapd-%s/ldif/Example.ldif" % (m1.sroot,m1.inst) # else: # initfile = "%s/share/dirsrv/data/Example.ldif" % os.environ.get('PREFIX', '/usr') # m1.importLDIF(initfile, '', "userRoot", True) print "show active connections . . ." ents = m1.search_s("cn=monitor", ldap.SCOPE_BASE, '(objectclass=*)',
port1 = cfgport+10 port2 = cfgport+20 root1 = "cn=directory manager" root2 = root1 rootpw1 = 'password' rootpw2 = rootpw1 suffix = "dc=example,dc=com" scope = ldap.SCOPE_SUBTREE filt = '(objectclass=*)' os.environ['USE_VALGRIND'] = "1" m1 = DSAdmin.createInstance({ 'newrootpw': rootpw1, 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': suffix, 'verbose': False, 'no_admin': True }) dn = "ou=virtualviews," + suffix ent = Entry(dn) ent.setValues('objectclass', 'organizationalUnit') print "Create view ou", dn m1.add_s(ent) mod = [(ldap.MOD_REPLACE, 'objectclass', ['top', 'organizationalUnit', 'nsView'])] print "add nsview to", dn m1.modify_s(dn, mod)
m1replargs = { 'suffix': "dc=example,dc=com", 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'log' : True } #os.environ['USE_DBX'] = "1" m1 = DSAdmin.createAndSetupReplica({ 'newrootpw': 'password', 'newhost': host1, 'newport': cfgport+10, 'newinst': 'm1', 'newsuffix': 'dc=example,dc=com', 'verbose': True, 'no_admin': True }, m1replargs ) #del os.environ['USE_DBX'] m2replargs = { 'suffix': "dc=example,dc=com", 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'log' : True } #os.environ['USE_DBX'] = 1
import os import ldap host1 = "localhost.localdomain" host2 = host1 cfgport = 1100 port1 = cfgport + 30 port2 = port1 + 10 #os.environ['USE_DBX'] = "1" m1 = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': 'dc=example,dc=com', 'verbose': True, 'no_admin': True }) #del os.environ['USE_DBX'] initfile = '' if os.environ.has_key('SERVER_ROOT'): initfile = "%s/slapd-%s/ldif/Example.ldif" % (m1.sroot,m1.inst) else: initfile = "%s/share/dirsrv/data/Example.ldif" % os.environ.get('PREFIX', '/usr') m1.importLDIF(initfile, '', "userRoot", True) #m1.setLogLevel(65535)
port1 = cfgport + 10 port2 = cfgport + 20 root1 = "cn=directory manager" root2 = root1 rootpw1 = 'password' rootpw2 = rootpw1 suffix = "dc=example,dc=com" scope = ldap.SCOPE_SUBTREE filt = '(objectclass=*)' os.environ['USE_VALGRIND'] = "1" m1 = DSAdmin.createInstance({ 'newrootpw': rootpw1, 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': suffix, 'verbose': False, 'no_admin': True }) dn = "ou=virtualviews," + suffix ent = Entry(dn) ent.setValues('objectclass', 'organizationalUnit') print "Create view ou", dn m1.add_s(ent) mod = [(ldap.MOD_REPLACE, 'objectclass', ['top', 'organizationalUnit', 'nsView'])] print "add nsview to", dn m1.modify_s(dn, mod)
'suffix': basedn, 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'bindmethod': 'SASL/GSSAPI', 'starttls': True, 'log' : False } #os.environ['USE_DBX'] = "1" m1 = DSAdmin.createAndSetupReplica({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': basedn, 'verbose': False, 'no_admin': True }, m1replargs ) #del os.environ['USE_DBX'] m2replargs = m1replargs #os.environ['USE_DBX'] = 1 m2 = DSAdmin.createAndSetupReplica({ 'newrootpw': 'password', 'newhost': host2, 'newport': port2, 'newinst': 'm2', 'newsuffix': basedn,
basedn = 'dc=example,dc=com' replargs = {} srvs = [] m1replargs = { 'suffix': basedn, 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl" } os.environ['USE_GDB'] = "1" m1 = DSAdmin.createAndSetupReplica({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': basedn, 'no_admin': True }, m1replargs ) del os.environ['USE_GDB'] replargs[m1] = m1replargs srvs.append(m1) m2replargs = m1replargs m2 = DSAdmin.createAndSetupReplica({ 'newrootpw': 'password', 'newhost': host2, 'newport': port2, 'newinst': 'm2', 'newsuffix': basedn,
def setupSSL(self, secport=0, sourcedir=os.environ['SECDIR'], secargs=None): """Bug scripts requires SECDIR.""" return DSAdmin.setupSSL(self, secport, sourcedir, secargs)
import sys import time import ldap host1 = "USEFQDN" port1 = 1200 secport1 = port1 + 1 basedn = "dc=example,dc=com" # os.environ['USE_DBX'] = "1" srv = DSAdmin.createInstance( { "newrootpw": "password", "newhost": host1, "newport": port1, "newinst": "srv", "newsuffix": basedn, "verbose": False, "no_admin": True, } ) # del os.environ['USE_DBX'] srv.setupSSL(secport1, os.environ["SECDIR"], {"nsslapd-security": "on"}) m1.replicaSetupAll(m1replargs) m2.replicaSetupAll(m2replargs) initfile = "" if os.environ.has_key("SERVER_ROOT"): initfile = "%s/slapd-%s/ldif/Example.ldif" % (m1.sroot, m1.inst)
'ConfigFile': configfile, 'no_admin': True } m1replargs = { 'suffix': basedn, 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'bindmethod': 'SASL/GSSAPI', 'log' : False } #os.environ['USE_GDB'] = "1" m1 = DSAdmin.createAndSetupReplica(hostargs, m1replargs) #del os.environ['USE_GDB'] hostargs['newhost'] = host2 hostargs['newport'] = port2 hostargs['newinst'] = 'm2' m2replargs = m1replargs m2 = DSAdmin.createAndSetupReplica(hostargs, m2replargs) hostargs['newhost'] = host3 hostargs['newport'] = port3 hostargs['newinst'] = 'm3' m3replargs = m2replargs m3 = DSAdmin.createAndSetupReplica(hostargs, m3replargs)
import time import ldap import pprint import base64, hashlib host1 = "localhost.localdomain" cfgport = 1100 port1 = cfgport + 30 basedn = 'dc=example,dc=com' newinst = 'ds' os.environ['USE_GDB'] = "1" srv = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': newinst, 'newsuffix': basedn, 'no_admin': True }) userdn = "ou=people," + basedn # make password password = "******" sha = hashlib.sha1(password) hashedpw = "{SHA}" + base64.b64encode(sha.digest()) + '\n' # add extra bogus newline # add user entry dn = "cn=foo," + userdn ent = Entry(dn) ent.setValues('objectclass', 'person')
def setupAgreement(self, repoth, args): """Set default replia credentials """ args.setdefault('binddn', REPLBINDDN) args.setdefault('bindpw', REPLBINDPW) return DSAdmin.createAgreement(self, repoth, args)
import ldap host1 = "localhost.localdomain" host2 = host1 port1 = 1130 port2 = port1 + 10 rootdn1 = "cn=directory manager" rootpw1 = 'password' rootdn2 = rootdn1 rootpw2 = rootpw1 suffix = "dc=example,dc=com" mux = DSAdmin.createInstance({ 'newrootpw': rootpw1, 'newhost': host1, 'newport': port1, 'newinst': 'mux', 'newsuffix': 'dc=notused', 'no_admin': True }) os.environ['USE_GDB'] = "1" farm = DSAdmin.createInstance({ 'newrootpw': rootpw2, 'newhost': host2, 'newport': port2, 'newinst': 'farm', 'newsuffix': 'dc=notused', 'no_admin': True }) # add the suffix
basedn = 'dc=example,dc=com' replargs = {} srvs = [] m1replargs = { 'suffix': basedn, 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl" } os.environ['USE_GDB'] = "1" m1 = DSAdmin.createAndSetupReplica( { 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': basedn, 'no_admin': True }, m1replargs) del os.environ['USE_GDB'] replargs[m1] = m1replargs srvs.append(m1) m2replargs = m1replargs m2 = DSAdmin.createAndSetupReplica( { 'newrootpw': 'password', 'newhost': host2, 'newport': port2, 'newinst': 'm2',
import tempfile from ldap.ldapobject import SimpleLDAPObject import pprint host1 = "localhost.localdomain" port1 = 1110 basedn = 'dc=example,dc=com' ldapifilepath = os.environ.get('PREFIX', "") + "/var/run/slapd-srv.socket" os.environ['USE_GDB'] = "1" srv = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'srv', 'newsuffix': basedn, 'no_admin': True, 'ldapifilepath': ldapifilepath }) del os.environ['USE_GDB'] ldapiurl = ldapurl.LDAPUrl(None, "ldapi", ldapifilepath) conn = SimpleLDAPObject(ldapiurl.initializeUrl()) print "connecting to", ldapiurl.initializeUrl() conn.simple_bind_s("cn=directory manager", "password") ents = conn.search_s("", ldap.SCOPE_BASE) pprint.pprint(ents)
m1replargs = { 'suffix': basedn, 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'log' : True } #os.environ['USE_DBX'] = "1" m1 = DSAdmin.createAndSetupReplica({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': basedn, 'verbose': True, 'no_admin': True }, m1replargs ) #del os.environ['USE_DBX'] m2replargs = m1replargs #os.environ['USE_DBX'] = 1 m2 = DSAdmin.createAndSetupReplica({ 'newrootpw': 'password', 'newhost': host2, 'newport': port2, 'newinst': 'm2', 'newsuffix': basedn,
import ldap host1 = "localhost.localdomain" host2 = host1 port1 = 1130 port2 = port1+10 rootdn1 = "cn=directory manager" rootpw1 = 'password' rootdn2 = rootdn1 rootpw2 = rootpw1 suffix = "dc=example,dc=com" mux = DSAdmin.createInstance({ 'newrootpw': rootpw1, 'newhost': host1, 'newport': port1, 'newinst': 'mux', 'newsuffix': 'dc=notused', 'no_admin': True }) os.environ['USE_GDB'] = "1" farm = DSAdmin.createInstance({ 'newrootpw': rootpw2, 'newhost': host2, 'newport': port2, 'newinst': 'farm', 'newsuffix': 'dc=notused', 'no_admin': True }) # add the suffix
#os.environ['USE_DBX'] = "1" m1replargs = { 'suffix': "dc=example,dc=com", 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl" } m1 = DSAdmin.createAndSetupReplica({ 'cfgdshost': host1, 'cfgdsport': cfgport, 'cfgdsuser': '******', 'cfgdspwd': 'admin', 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': 'dc=example,dc=com', 'verbose': True, 'have_admin': True }, m1replargs) #del os.environ['USE_DBX'] #os.environ['USE_DBX'] = 1 m2replargs = { 'suffix': "dc=example,dc=com", 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl"
basedn = "dc=example,dc=com" binddn = "cn=directory manager" bindpw = "password" # basedn = "dc=testdomain,dc=com" # host1 = 'el4i386' # port1 = 389 # m1 = DSAdmin(host1, port1, binddn, bindpw) # os.environ['USE_VALGRIND'] = "1" m1 = DSAdmin.createInstance( { "newrootpw": "password", "newhost": host1, "newport": port1, "newinst": "m1", "newsuffix": basedn, "verbose": False, "no_admin": True, } ) # del os.environ['USE_VALGRIND'] # initfile = '' # if os.environ.has_key('SERVER_ROOT'): # initfile = "%s/slapd-%s/ldif/Example.ldif" % (m1.sroot,m1.inst) # else: # initfile = "%s/share/dirsrv/data/Example.ldif" % os.environ.get('PREFIX', '/usr') # m1.importLDIF(initfile, '', "userRoot", True) print "show active connections . . ."
root2 = root1 rootpw1 = 'password' rootpw2 = rootpw1 basedn = "dc=example,dc=com" m1replargs = { 'suffix': basedn, 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'bindmethod': 'SASL/DIGEST-MD5', 'log': False } m1 = DSAdmin(host1, port1, root1, rootpw1) m1.replicaSetupAll(m1replargs) m2replargs = m1replargs m2 = DSAdmin(host2, port2, root2, rootpw2) m2.replicaSetupAll(m2replargs) print "create agreements and init consumers" agmtm1tom2 = m1.setupAgreement(m2, m1replargs) time.sleep(5) m1.setLogLevel(1024) m1.startReplication_async(agmtm1tom2) print "waiting for init to finish" time.sleep(5) m1.waitForReplInit(agmtm1tom2) agmtm2tom1 = m2.setupAgreement(m1, m2replargs)
host2 = "vmf9x8664" port1 = 389 port2 = port1 rootpw = "secret12" m1replargs = { 'suffix': "dc=example,dc=com", 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl" # 'log' : False } m2replargs = m1replargs m1 = DSAdmin(host1, port1, "cn=directory manager", rootpw) m2 = DSAdmin(host2, port2, "cn=directory manager", rootpw) m1.replicaSetupAll(m1replargs) m2.replicaSetupAll(m2replargs) print "create agreements and init consumers" agmtm1tom2 = m1.setupAgreement(m2, m1replargs) m1.startReplication_async(agmtm1tom2) print "waiting for init to finish" m1.waitForReplInit(agmtm1tom2) agmtm2tom1 = m2.setupAgreement(m1, m2replargs) sys.exit(0) basedn = "dc=example,dc=com"
m1replargs = { 'suffix': suffix, 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'log': True } #os.environ['USE_DBX'] = "1" m1 = DSAdmin.createAndSetupReplica( { 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': suffix, 'verbose': True, 'no_admin': True }, m1replargs) #del os.environ['USE_DBX'] m2replargs = m1replargs #os.environ['USE_DBX'] = 1 m2 = DSAdmin.createAndSetupReplica( { 'newrootpw': 'password', 'newhost': host2, 'newport': port2, 'newinst': 'm2', 'newsuffix': suffix,
'winsync': True, 'newwingroups': 'true', 'log': False } configfile = [] schemafile = [] #os.environ['USE_VALGRIND'] = "1" os.environ['USE_GDB'] = "1" ds = DSAdmin.createAndSetupReplica({ 'newrootpw': rootpw1, 'newhost': host1, 'newport': port1, 'newinst': 'ds', 'newsuffix': suffix, 'verbose': False, 'no_admin': True, 'ConfigFile': configfile, 'SchemaFile': schemafile }, replargs ) #os.environ['USE_VALGRIND'] = '' #os.environ.pop('USE_VALGRIND') #try: # foo = os.environ['USE_VALGRIND'] #except KeyError: # print "should no longer have USE_VALGRIND env. var" if useds: ad = DSAdmin.createInstance({ 'newrootpw': rootpw2,
m1replargs = { 'suffix': basedn, 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'log' : False } m2replargs = m1replargs os.environ['USE_VALGRIND'] = "1" m1 = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': basedn, 'verbose': False, 'no_admin': True }) del os.environ['USE_VALGRIND'] m2 = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host2, 'newport': port2, 'newinst': 'm2', 'newsuffix': basedn, 'verbose': False, 'no_admin': True })
#os.environ['USE_DBX'] = "1" m1replargs = { 'suffix': "dc=example,dc=com", 'bename': "userRoot", 'binddn': "cn=replrepl,cn=config", 'bindcn': "replrepl", 'bindpw': "replrepl", 'chain' : True } m1 = DSAdmin.createInstance({ 'newrootpw': 'password', 'newhost': host1, 'newport': port1, 'newinst': 'm1', 'newsuffix': 'dc=example,dc=com', 'verbose': True, 'no_admin': True }) #del os.environ['USE_DBX'] print "Set the cache size really low" replace = [(ldap.MOD_REPLACE, 'nsslapd-cachememsize', '500000')] m1.modify_s('cn=userRoot,cn=ldbm database,cn=plugins,cn=config', replace) print "restart the server to force cache size change to take effect" m1.stop(True) m1.start(True) time.sleep(1)