api.py (ec2-api-14.0.1) | : | api.py (ec2-api-15.0.0) | ||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | |||
# limitations under the License. | # limitations under the License. | |||
import base64 | import base64 | |||
import itertools | import itertools | |||
from novaclient import exceptions as nova_exception | from novaclient import exceptions as nova_exception | |||
from oslo_cache import core as cache_core | from oslo_cache import core as cache_core | |||
from oslo_config import cfg | from oslo_config import cfg | |||
from oslo_log import log as logging | from oslo_log import log as logging | |||
import six | ||||
from ec2api.api import clients | from ec2api.api import clients | |||
from ec2api.api import ec2utils | from ec2api.api import ec2utils | |||
from ec2api.api import instance as instance_api | from ec2api.api import instance as instance_api | |||
from ec2api import exception | from ec2api import exception | |||
CONF = cfg.CONF | CONF = cfg.CONF | |||
LOG = logging.getLogger(__name__) | LOG = logging.getLogger(__name__) | |||
VERSIONS = [ | VERSIONS = [ | |||
skipping to change at line 286 | skipping to change at line 285 | |||
else: | else: | |||
output += key + '/' | output += key + '/' | |||
else: | else: | |||
output += key | output += key | |||
output += '\n' | output += '\n' | |||
return output[:-1] | return output[:-1] | |||
elif isinstance(data, list): | elif isinstance(data, list): | |||
return '\n'.join(data) | return '\n'.join(data) | |||
else: | else: | |||
return six.text_type(data) | return str(data) | |||
def _find_path_in_tree(data, path_tokens): | def _find_path_in_tree(data, path_tokens): | |||
# given a dict/list tree, and a path in that tree, return data found there. | # given a dict/list tree, and a path in that tree, return data found there. | |||
for i in range(0, len(path_tokens)): | for i in range(0, len(path_tokens)): | |||
if isinstance(data, dict) or isinstance(data, list): | if isinstance(data, dict) or isinstance(data, list): | |||
if path_tokens[i] in data: | if path_tokens[i] in data: | |||
data = data[path_tokens[i]] | data = data[path_tokens[i]] | |||
else: | else: | |||
raise exception.EC2MetadataNotFound() | raise exception.EC2MetadataNotFound() | |||
else: | else: | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added |