<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> import logging <EOL> try : <EOL> import salt . utils . etcd_util <EOL> HAS_LIBS = True <EOL> except ImportError : <EOL> HAS_LIBS = False <EOL> __virtualname__ = '<STR_LIT>' <EOL> log = logging . getLogger ( __name__ ) <EOL> def __virtual__ ( ) : <EOL> '''<STR_LIT>''' <EOL> return __virtualname__ if HAS_LIBS else False <EOL> def ext_pillar ( minion_id , <EOL> pillar , <EOL> conf ) : <EOL> '''<STR_LIT>''' <EOL> comps = conf . split ( ) <EOL> profile = None <EOL> if comps [ <NUM_LIT:0> ] : <EOL> profile = comps [ <NUM_LIT:0> ] <EOL> client = salt . utils . etcd_util . get_conn ( __opts__ , profile ) <EOL> path = '<STR_LIT:/>' <EOL> if len ( comps ) > <NUM_LIT:1> and comps [ <NUM_LIT:1> ] . startswith ( '<STR_LIT>' ) : <EOL> path = comps [ <NUM_LIT:1> ] . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> path %= { <EOL> '<STR_LIT>' : minion_id <EOL> } <EOL> try : <EOL> pillar = salt . utils . etcd_util . tree ( client , path ) <EOL> except KeyError : <EOL> log . error ( '<STR_LIT>' . format ( profile , path ) ) <EOL> pillar = { } <EOL> return pillar </s>
