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

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

问题描述

我昨天编写了这个程序,除了由 CRON 运行时,它实际上可以工作.今天,我运行了相同的脚本,但它不起作用.该脚本将在没有任何 Tracebacks 错误的情况下运行,并且它将从 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 + '
')
    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?

感谢您的时间和关注.

推荐答案

尽量不要使用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 程序 Sketchy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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