Python ClearCase下载Vobs Popen密码BASH程序粗略 [英] Python ClearCase Download Vobs Popen Password BASH Program Sketchy

查看:106
本文介绍了Python ClearCase下载Vobs Popen密码BASH程序粗略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我昨天对该程序进行了编码,除了由CRON运行时,它实际上已经在运行.今天,我运行了相同的脚本,但它不起作用.该脚本将运行而不会出现任何回溯错误",并且它将从ClearCase视图复制顶部文件夹(vob),但在目标文件夹下面的文件夹和文件中没有任何实际的重要数据.

I coded this program yesterday and it was actually working except for when run by CRON. Today, I ran the same script and it does not work. The script will run without any Tracebacks Errors, and it will copy the top folder (vob) from the ClearCase view, but none of the actual important data in the folders and files below the target folder.

这是我的Python脚本.

Here is my Python script.

def obtainCode(view="My_VIEW", folder="/my_folder"):
    """Download code from ClearCase's File System and put it on the hard-drive"""

    dest = '/etc/foo'
    password = 'passwords'

    v1 = subprocess.Popen(['cleartool', 'setview', view], shell=True, stdout=subprocess.PIPE)
    print "v1 = ", v1
    print "view maybe set :/"

    c1 = subprocess.Popen(['sudo', '-p', '', '-S', 'cp', '-r', folder, dest], stdin=subprocess.PIPE)
    c1.stdin.write(password + '\n')
    c1.stdin.close()
    c1.wait()

    #### Close View and Stop Processes ####
    v2 = subprocess.Popen(['cleartool', 'endview', view], shell=True, stdin=v1.stdout, stdout=subprocess.PIPE)


    v2.kill()
    v1.kill()

有人知道吗: 1)出了什么问题2)为什么昨天仍然可以工作,但今天不工作3)这样做的更好方法?

Does anyone know: 1) what is going wrong 2) why it would work yesterday but not today 3) a better way to do this?

谢谢您的时间和精力.

Thank-you for your time and attention.

推荐答案

尝试而不使用setview.
您不需要它,而可以使用视图的完整路径.

Try and not use setview.
You do not need it and you can use the full path of the view instead.

cleartool startview yourDynamicView
cd /view/yourDynamicView/vobs/yourVob

我之前曾提到使用setview的危险(" Python和ClearCase setview ").
它会在您的子流程中创建一个子流程,这里不需要.

I have mentioned before the danger of using setview ("Python and ClearCase setview").
It creates a subprocess within your subprocess, which is not needed here.

这篇关于Python ClearCase下载Vobs Popen密码BASH程序粗略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆