Module Expr Str Import alias Import alias Import alias Import alias Import alias Import alias Assign NameStore Str Assign NameStore Num ClassDef bases NameLoad body Pass decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Str If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Str Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body While NameLoad body TryExcept body Expr Call AttributeLoad NameLoad attr handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str TryExcept body Assign NameStore BinOpAdd NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword Num Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body Expr Call AttributeLoad NameLoad attr If CompareEq AttributeLoad NameLoad attr Num body Return ListLoad Raise NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad BinOpAdd Str Str attr AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr If Call AttributeLoad NameLoad attr NameLoad NameLoad body Raise Call NameLoad Str Assign TupleStore NameStore NameStore NameStore NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad Return TupleLoad Call NameLoad NameLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str If BoolOpAnd UnaryOpNot NameLoad UnaryOpNot NameLoad body Return Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad BoolOpOr NameLoad NameLoad BoolOpOr NameLoad NameLoad BoolOpOr NameLoad NameLoad BoolOpOr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr Str For NameStore NameLoad body If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad BinOpMod Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad BinOpMod Str NameLoad body Return NameLoad orelse Return NameLoad decorator_list decorator_list
N/A N/A Manage extra network interface addresses on a GCE instance.

Fetch a list of public endpoint IPs from the metadata server, compare it with
what's configured on eth0, and add/remove addresses from eth0 to make them
match.  Only remove those which match our proto code.

This must be run by root. If it reads any malformed data, it will take no
action.

Command used to add ips:
  ip route add to local $IP/32 dev eth0 proto 66
Command used to fetch list of configured IPs:
  ip route ls table local type local dev eth0 scope host proto 66
 N/A logging N/A os N/A re N/A socket N/A time N/A urllib2 N/A PUBLIC_ENDPOINT_URL_PREFIX http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/forwarded-ips/?recursive=true&alt=text&wait_for_change=true&timeout_sec=60&last_etag= N/A GOOGLE_PROTO_ID 66 InputError N/A Exception N/A N/A N/A AddressManager N/A object N/A N/A Manage public endpoint IPs. __init__ N/A N/A self system_module urllib2_module time_module N/A urllib2 time N/A N/A N/A self system system_module N/A N/A self urllib2 urllib2_module N/A N/A self time time_module N/A N/A self ip_path /sbin/ip N/A N/A N/A N/A N/A os path exists N/A self ip_path N/A N/A N/A self ip_path /bin/ip N/A N/A self default_last_etag NONE N/A N/A N/A self ResetEtag N/A SyncAddressesForever N/A N/A self N/A N/A N/A True N/A N/A N/A N/A N/A N/A self SyncAddresses N/A N/A N/A N/A socket timeout N/A e N/A N/A N/A N/A self ResetEtag N/A N/A N/A logging warning Backend timeout.  Retrying. N/A N/A Exception N/A e N/A N/A N/A N/A self ResetEtag N/A N/A N/A logging error SyncAddresses exception: %s e N/A N/A N/A N/A self time sleep 5 N/A SyncAddresses N/A N/A self N/A N/A N/A Main entry point -- syncs configured w/ desired IP addresses. N/A addrs_wanted N/A N/A self ReadPublicEndpoints N/A addrs_configured N/A N/A self ReadLocalConfiguredAddrs N/A N/A to_add to_remove N/A N/A self DiffAddrs addrs_wanted addrs_configured N/A N/A N/A self LogChanges addrs_wanted addrs_configured to_add to_remove N/A N/A N/A self AddAddresses to_add N/A N/A N/A self DeleteAddresses to_remove N/A ResetEtag N/A N/A self N/A N/A N/A Reset the etag so the next call will return the current data. N/A N/A self last_etag N/A self default_last_etag N/A ReadPublicEndpoints N/A N/A self N/A N/A N/A Fetch list of public endpoint IPs from metadata server. N/A N/A N/A url N/A PUBLIC_ENDPOINT_URL_PREFIX N/A self last_etag N/A request N/A N/A urllib2 Request url N/A N/A N/A request add_unredirected_header Metadata-Flavor Google N/A u N/A N/A N/A self urllib2 urlopen request timeout 70 N/A addrs_data N/A N/A u read N/A headers N/A N/A N/A u info dict N/A N/A self last_etag N/A N/A headers get etag N/A self default_last_etag N/A N/A N/A N/A urllib2 HTTPError N/A h N/A N/A N/A N/A self ResetEtag N/A N/A N/A h code 404 N/A N/A N/A N/A h N/A N/A N/A self ParseIPAddrs addrs_data N/A ReadLocalConfiguredAddrs N/A N/A self N/A N/A N/A Fetch list of addresses we've configured on eth0 already. N/A cmd N/A N/A N/A {0} route ls table local type local dev eth0 scope host  proto {1:d} format N/A self ip_path GOOGLE_PROTO_ID N/A result N/A N/A N/A self system RunCommand N/A N/A cmd split N/A N/A N/A self IPCommandFailed result cmd N/A N/A N/A InputError Cant check local addresses N/A N/A rc stdout stderr result N/A N/A N/A self ParseIPAddrs stdout N/A DiffAddrs N/A N/A self addrs_wanted addrs_configured N/A N/A N/A "Returns set differences: (to_add, to_remove). N/A want N/A set addrs_wanted N/A have N/A set addrs_configured N/A to_add N/A want have N/A to_remove N/A have want N/A N/A N/A sorted to_add N/A sorted to_remove N/A LogChanges N/A N/A self addrs_wanted addrs_configured to_add to_remove N/A N/A N/A Log what addrs we are going to change. N/A N/A N/A to_add N/A to_remove N/A N/A N/A N/A N/A logging info N/A Changing public IPs from %s to %s by adding %s and removing %s N/A N/A addrs_configured None N/A addrs_wanted None N/A to_add None N/A to_remove None N/A AddAddresses N/A N/A self to_add N/A N/A N/A Configure new addresses on eth0. N/A addr to_add N/A N/A N/A N/A self AddOneAddress addr N/A AddOneAddress N/A N/A self addr N/A N/A N/A Configure one address on eth0. N/A cmd N/A %s route add to local %s/32 dev eth0 proto %d N/A N/A self ip_path addr GOOGLE_PROTO_ID N/A result N/A N/A N/A self system RunCommand N/A N/A cmd split N/A N/A N/A self IPCommandFailed result cmd N/A DeleteAddresses N/A N/A self to_remove N/A N/A N/A Un-configure a list of addresses from eth0. N/A addr to_remove N/A N/A N/A N/A self DeleteOneAddress addr N/A DeleteOneAddress N/A N/A self addr N/A N/A N/A Delete one address from eth0. N/A cmd N/A %s route delete to local %s/32 dev eth0 proto %d N/A N/A self ip_path addr GOOGLE_PROTO_ID N/A result N/A N/A N/A self system RunCommand N/A N/A cmd split N/A N/A N/A self IPCommandFailed result cmd N/A ParseIPAddrs N/A N/A self addrs_data N/A N/A N/A Parse and validate IP addrs, return list of strings or None. N/A addrs N/A N/A N/A N/A addrs_data strip split N/A reg N/A N/A re compile ^([0-9]+.){3}[0-9]+$ N/A addr addrs N/A N/A N/A N/A N/A reg search addr N/A N/A N/A InputError N/A Failed to parse ip addr: "%s" addr N/A addrs N/A IPCommandFailed N/A N/A self result cmd N/A N/A N/A If an /sbin/ip command failed, log and return True. N/A N/A N/A N/A self system RunCommandFailed result N/A Non-zero exit status from: "%s" cmd N/A N/A True N/A N/A False N/A N/A