Hi Jack,

On 08/19/11 07:26, Jack Schwartz wrote:
 Hi Jan.

On 08/18/11 14:45, Jan Damborsky wrote:
Hi Jack,

thank you for review.

I went with list of dictionaries, since dictionary does not implement
sort() method, so sorting dictionary would require some additional
juggling with its content.

That said, it would not be perhaps a complex thing to do, so if you
would prefer going with single dictionary, please let me know.
I thought I'd play with the idea before responding, so I wrote some tiny test programs... What is implemented can be reduced to this:

--------------------
from operator import itemgetter

a = list()
a.append({"name":"net2", "label":"bge0"})
a.append({"name":"net0", "label":"zge0"})
a.append({"name":"net1", "label":"nge0"})
a.sort(key=itemgetter("name"))
for aitem in a:
    print aitem["name"] + " " + aitem["label"]

--------------------

Then I implemented with a single dictionary:

d = dict()
d["net2"] = "bge0"
d["net0"] = "zge0"
d["net1"] = "nge0"
a = d.keys()
a.sort()
for aitem in a:
    print aitem + " " + d[aitem]

--------------------

Both return
net0 zge0
net1 nge0
net2 bge0

Based on the above, a single dictionary approach seems simpler and code seems more straightforward.

I can see your point.
The disadvantage is that if we went with single dictionary, consumer would be in charge of sorting the dictionary on each use. Going with list allows us to keep sorting encapsulated within find_links() function. In that case sorting is done only once when list of NICs
is generated.


Consider this food for thought. I leave the final decision to you. I'm OK whether you keep it as is or change it.

Based on what I stated above, I would prefer to go with more complex
data model - list of dictionaries.

Thank you very much for review and for your time you spent looking into this.

Jan


    Thanks,
    Jack



Jan


On 08/18/11 18:19, Jack Schwartz wrote:
Hi Jan.

Code looks like it will work, but I have a question:

How come a list of dictionaries, instead of a single dictionary for all NICs?

    Thanks,
    Jack

On 08/18/11 07:29 AM, Jan Damborsky wrote:
Hi all,

could I please ask two pair of eyes to take a look at fix for

7078155 snv171 text installer provides insufficient NIC information after vanity-naming-by default went in.

webrev:
https://cr.opensolaris.org/action/browse/caiman/dambi/cr-7078155/webrev/

Thank you,
Jan

tests done:

* installation with modified Sparc text installer booted from network
* installation with modified x86 text installer booted from media
* configuration of non-global zone with exclusive IP stack

_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss


:q

_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss

Reply via email to