如果在第一组数据中找不到任何内容,如何遍历第二组数据?
flow start IOUFlow iouValue: 99, otherParty: PartyB
In [113]: bpimage_cmd_split
Out[113]:
['Client: hostname',
'Backup ID: hostname_1555238197',
'Policy: Policy1',
'Proxy Client: (none specified)',
'Job ID: 4630451',
'Data_Classification_ID: (none specified)',
'Storage Lifecycle Policy: SLP-DATA-Infinite',
'Origin Master GUID: (none specified)',
' ID: @aaaaC',
' ID: @aaaaE',
' ID: L02551',]
In [151]: type(bpimage_cmd_split)
Out[151]: list
代码按预期工作。
但是,通过更多的质量检查测试,来自last_backup_image,bpimage_cmd_split的数据是否有“ ID:”,就像所有@aaaa一样,因为备份作业仍在运行?如果是这种情况,那么我希望它遍历“ second_backup_image”并获取不包含@aaa的ID?
答案 0 :(得分:0)
if "ID" not in backup_client_info:
bpimage_cmd = ssh_connect.run(rf"sudo /usr/openv/netbackup/bin/admincmd/bpimagelist -L -backupid {second_backup_image} -media | egrep -e 'Policy:' -e 'ID:' -e 'Client:'")