def expect_webdav_exist(path, user_num=None): exitcode, stdout, stderr = runcmd( 'curl -s -k %s -XPROPFIND %s | xmllint --format - | grep NotFound | wc -l' % (config.get('curl_opts', ''), oc_webdav_url(remote_folder=path, user_num=user_num))) exists = stdout.rstrip() == "0" error_check(exists, "Remote path %s exists but should not" % path)
def webdav_mkcol(path, silent=False, user_num=None): out = "" if silent: # a workaround for super-verbose errors in case directory on the server already exists out = "> /dev/null 2>&1" runcmd('curl --verbose -k %s -X MKCOL %s %s' % (config.get('curl_opts', ''), oc_webdav_url(remote_folder=path, user_num=user_num), out))
def webdav_mkcol(path, silent=True, user_num=None): # work around buggy pycurl.so on MacOSX... buggy pycurl also on linux: https://bugzilla.redhat.com/show_bug.cgi?id=1317691 if platform.system() != "Windows": out="" import logging if silent or config._loglevel > logging.DEBUG: # a workaround for super-verbose errors in case directory on the server already exists out = "> /dev/null 2>&1" echo=False else: echo=True runcmd('curl --verbose -k %s -X MKCOL %s %s'%(config.get('curl_opts',''),oc_webdav_url(remote_folder=path, user_num=user_num),out),echo=echo) else: import smashbox.curl c = smashbox.curl.Client(verbose=not silent) url = oc_webdav_url(remote_folder=path, user_num=user_num) return c.MKCOL(url)
def webdav_delete(path, silent=True, user_num=None): # work around buggy pycurl.so on MacOSX... buggy pycurl also on linux: https://bugzilla.redhat.com/show_bug.cgi?id=1317691 if platform.system() != "Windows": import logging if config._loglevel <= logging.DEBUG: verbose = "--verbose" echo=True else: verbose = "" echo=False runcmd('curl %s -k %s -X DELETE %s '%(verbose,config.get('curl_opts',''),oc_webdav_url(remote_folder=path, user_num=user_num)),echo=echo) else: import smashbox.curl c = smashbox.curl.Client(verbose=not silent) # FIXME: handle config.get('curl_opts','') url = oc_webdav_url(remote_folder=path, user_num=user_num) return c.DELETE(url)
def webdav_delete(path, silent=True, user_num=None): # work around buggy pycurl.so on MacOSX... if platform.system() == "Darwin": import logging if config._loglevel <= logging.DEBUG: verbose = "--verbose" echo = True else: verbose = "" echo = False runcmd('curl %s -k %s -X DELETE %s ' % (verbose, config.get('curl_opts', ''), oc_webdav_url(remote_folder=path, user_num=user_num)), echo=echo) else: import smashbox.curl c = smashbox.curl.Client( verbose=not silent) # FIXME: handle config.get('curl_opts','') url = oc_webdav_url(remote_folder=path, user_num=user_num) return c.DELETE(url)
def webdav_delete(path, user_num=None): runcmd('curl --verbose -k %s -X DELETE %s ' % (config.get('curl_opts', ''), oc_webdav_url(remote_folder=path, user_num=user_num)))
def webdav_mkcol(path,silent=False): out="" if silent: # a workaround for super-verbose errors in case directory on the server already exists out = "> /dev/null 2>&1" runcmd('curl -k %s -X MKCOL %s %s'%(config.get('curl_opts',''),oc_webdav_url(remote_folder=path),out))
def webdav_delete(path): runcmd('curl -k %s -X DELETE %s '%(config.get('curl_opts',''),oc_webdav_url(remote_folder=path)))
def webdav_propfind_ls(path): runcmd('curl -s -k %s -XPROPFIND %s | xmllint --format -'%(config.get('curl_opts',''),oc_webdav_url(remote_folder=path)))
def webdav_propfind_ls(path, user_num=None): runcmd('curl -s -k %s -XPROPFIND %s | xmllint --format -' % (config.get('curl_opts', ''), oc_webdav_url(remote_folder=path, user_num=user_num)))
def webdav_delete(path, user_num=None): runcmd('curl --verbose -k %s -X DELETE %s '%(config.get('curl_opts',''),oc_webdav_url(remote_folder=path, user_num=user_num)))
def webdav_delete(path): runcmd('curl -k %s -X DELETE %s ' % (config.get('curl_opts', ''), oc_webdav_url(remote_folder=path)))
def expect_webdav_exist(path, user_num=None): exitcode,stdout,stderr = runcmd('curl -s -k %s -XPROPFIND %s | xmllint --format - | grep NotFound | wc -l'%(config.get('curl_opts',''),oc_webdav_url(remote_folder=path, user_num=user_num))) exists = stdout.rstrip() == "0" error_check(exists, "Remote path %s exists but should not" % path)