oB]c@s:ddlmZddlmZdefdYZdS(i(tStringIO(t chop_commentt HostnameConfcBsDeZdZdZdZedZdZdZRS(cCs||_d|_dS(N(t_texttNonet _contents(tselfttext((sF/usr/lib/python2.7/site-packages/cloudinit/distros/parsers/hostname.pyt__init__s cCs+|jdkr'|j|j|_ndS(N(RRt_parseR(R((sF/usr/lib/python2.7/site-packages/cloudinit/distros/parsers/hostname.pytparsescCs|jt}x|jD]\}}|dkrM|jd|dq|dkrq|jd|dq|dkr|\}}|jd||fqqW|j}|jds|d7}n|S(Ntblanks%s it all_commentthostnames%s%s s (R RRtwritetgetvaluetendswith(Rtcontentst line_typet componentsR ttail((sF/usr/lib/python2.7/site-packages/cloudinit/distros/parsers/hostname.pyt__str__s        cCs<|jx+|jD] \}}|dkr|dSqWdS(NR i(R RR(RRR((sF/usr/lib/python2.7/site-packages/cloudinit/distros/parsers/hostname.pyR 's    cCs|j}|sdS|jt}x<|jD]1\}}|dkr0t||ds