~e4ddlmZdZdedZdZd dZd dZy) ) fetch_asyncz169.254.169.254zhttp://z/latest@Ncgtd}|jfd|jfdfd}|j||S)zFetch EC2 information about the cloud instance. The fetch parameter provided above is for non-mocked testing purposes. instance-idctdS)N instance-type_fetch_ec2_itemignore cloud_datafetchs 5/usr/lib/python3/dist-packages/landscape/lib/cloud.pyz%fetch_ec2_meta_data..s EJctdS)Nami-idr r s rrz%fetch_ec2_meta_data..sxUCrcFd}\}}}||||||dS)z1Record the instance data returned by the EC2 API.c\|*t|tr|jd}|dtSy)Nzutf-8) isinstancebytesdecode MAX_LENGTH)values r_process_resultzCfetch_ec2_meta_data..return_result.._process_results2 eU+!LL1E[j))!r)rrr)r r instance_id instance_typeami_idr s r return_resultz*fetch_ec2_meta_data..return_results8 * 0:,mV*;7%f-,];  r)r addCallback)rdeferredr r s` @rfetch_ec2_meta_datar#sX J}j%@H J C  ' Orcptdz|z}|t}||dj|jS)z Get data at C{path} on the EC2 API endpoint, and add the result to the C{accumulate} list. The C{fetch} parameter is provided for testing only. z /meta-data/F)follow)EC2_APIrr!append)path accumulaterurls rr r ,s; M !D (C } U # / / 0A0A BBr)N)landscape.lib.fetchrEC2_HOSTr&rr#r rrrr-s,+  H:W %  !HCr