* Fosiul Alam <[email protected]> [2016-01-04 22:29]: > Hi Expert, > I am learning python to do some system admin code, i am still in the > process of learning but I need a help on bellow code in urgent, i will be > really greatfull for any help > > Basically i wanted like this :- > > grep a line which has 1:0:0:129 , and get the LUN number(i.e > 360060165656565634348a739e511) for this path > > so the Dictionalry will be : > > dict = {'360060165656565634348a739e511': '1:0:0:129', > '3600601323h42h2k323asdf33511': 1:0:2:98}; > > > How can i do this ?
based on your multipath output, one thing you have to take into account is that the LUN value comes before the SCSI value. You are going to have to walk the file and for each mpath line, create a dict, then add your SCSI values to that entry. You will have to find a way to break out of your logic when the next mpath is seen. You will also want to think about what to do with all your LUNs. You have four per mpath, not one. Do you want to capture only one, or do you need all of them? -- David Rock [email protected] _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
