Module Import alias Import alias Import alias TryExcept body Import alias identifier handlers ExceptHandler type NameLoad body Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore AttributeLoad NameLoad attr ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body If NameLoad body Assign AttributeStore NameLoad attr NameLoad With Call AttributeLoad NameLoad attr Str NameLoad body With Call AttributeLoad NameLoad attr Str NameStore body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareIsNot NameLoad NameLoad body If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr NameLoad orelse Assign NameStore BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num orelse Expr Call AttributeLoad NameLoad attr NameLoad decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr keyword Str decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr keyword Str keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr ListLoad NameLoad If BoolOpAnd Call NameLoad NameLoad AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse If BoolOpAnd Call NameLoad NameLoad AttributeLoad NameLoad attr CompareNotEq AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr keyword Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Num Str Dict NameLoad Expr Call AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Num Str Dict NameLoad Expr Call AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Assign NameStore SubscriptLoad NameLoad Slice Num Assign NameStore ListComp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call NameLoad GeneratorExp Call AttributeLoad NameLoad attr Str comprehension NameStore NameLoad Assign NameStore Set Str Str Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr Str SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr Str SubscriptLoad NameLoad Index Str decorator_list Call AttributeLoad NameLoad attr Str Str Call AttributeLoad NameLoad attr Str Str Call AttributeLoad NameLoad attr Str Str Call AttributeLoad NameLoad attr Str Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body With Call AttributeLoad NameLoad attr Str Str body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Str Assign AttributeStore NameLoad attr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Call NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad decorator_list Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr BinOpMod Str AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr BinOpMod Str AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore ListLoad Str Str Assign NameStore BinOpAdd Call AttributeLoad Str attr NameLoad Str Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr BinOpMod Str AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore ListComp Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad comprehension NameStore TupleLoad Str Str Assign AttributeStore NameLoad attr BinOpAdd Call AttributeLoad Str attr NameLoad Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr BinOpMod Str AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr BinOpMod Str AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list Call AttributeLoad NameLoad attr Str decorator_list
N/A N/A os N/A posixpath N/A unittest N/A N/A N/A unittest.mock mock N/A N/A N/A ImportError N/A N/A mock oslo_config cfg six.moves.urllib error cloudbaseinit.metadata.services base cloudbaseinit.metadata.services maasservice cloudbaseinit.tests testutils cloudbaseinit.utils x509constants N/A CONF N/A cfg CONF MaaSHttpServiceTest N/A N/A unittest TestCase N/A setUp N/A N/A self N/A N/A N/A N/A self _maasservice N/A N/A maasservice MaaSHttpService N/A _test_load N/A N/A self mock_get_cache_data ip cache_data_fails N/A False N/A N/A cache_data_fails N/A N/A N/A mock_get_cache_data side_effect Exception N/A N/A N/A testutils ConfPatcher maas_metadata_url ip N/A N/A N/A N/A testutils LogSnatcher cloudbaseinit.metadata.services.maasservice snatcher N/A N/A response N/A N/A N/A self _maasservice load N/A N/A ip None N/A N/A N/A cache_data_fails N/A N/A N/A N/A mock_get_cache_data assert_called_once_with N/A %s/meta-data/ N/A N/A self _maasservice _metadata_version N/A N/A N/A self assertTrue response N/A N/A expected_logging N/A Metadata not found at URL '%s' ip N/A N/A N/A self assertEqual expected_logging N/A N/A snatcher output N/A -1 N/A N/A N/A N/A self assertFalse response N/A N/A N/A mock patch cloudbaseinit.metadata.services.maasservice.MaaSHttpService._get_cache_data test_load N/A N/A self N/A N/A N/A N/A N/A self _test_load ip 196.254.196.254 N/A test_load_no_ip N/A N/A self N/A N/A N/A N/A N/A self _test_load ip None N/A test_load_get_cache_data_fails N/A N/A self N/A N/A N/A N/A N/A self _test_load ip 196.254.196.254 cache_data_fails True N/A _test_get_response N/A N/A self mock_urlopen ret_val N/A N/A N/A mock_request N/A N/A mock MagicMock N/A N/A mock_urlopen side_effect N/A ret_val N/A N/A N/A isinstance ret_val N/A error HTTPError N/A N/A ret_val code 404 N/A N/A N/A N/A self assertRaises N/A base NotExistingMetadataException N/A N/A self _maasservice _get_response mock_request N/A N/A N/A N/A isinstance ret_val N/A error HTTPError N/A N/A ret_val code 404 N/A N/A N/A N/A self assertRaises N/A error HTTPError N/A N/A self _maasservice _get_response mock_request N/A N/A response N/A N/A N/A self _maasservice _get_response req mock_request N/A N/A N/A mock_urlopen assert_called_once_with mock_request N/A N/A N/A self assertEqual ret_val response N/A N/A N/A mock patch six.moves.urllib.request.urlopen test_get_response N/A N/A self N/A N/A N/A N/A N/A self _test_get_response ret_val fake response N/A test_get_response_error_404 N/A N/A self N/A N/A N/A err N/A N/A error HTTPError http://169.254.169.254/ 404 test error 404 N/A None N/A N/A N/A self _test_get_response ret_val err N/A test_get_response_error_not_404 N/A N/A self N/A N/A N/A err N/A N/A error HTTPError http://169.254.169.254/ 409 test other error N/A None N/A N/A N/A self _test_get_response ret_val err N/A test_get_oauth_headers N/A N/A self N/A N/A N/A response N/A N/A N/A self _maasservice _get_oauth_headers url 196.254.196.254 N/A N/A N/A self assertIsInstance response dict N/A N/A N/A self assertIn Authorization response N/A auth N/A response N/A Authorization N/A N/A N/A self assertTrue N/A N/A auth startswith OAuth N/A auth N/A auth N/A 6 N/A parts N/A N/A N/A item strip N/A item N/A N/A auth split , N/A auth_parts N/A dict N/A N/A N/A part split = N/A part parts N/A required_headers N/A oauth_token oauth_consumer_key oauth_signature N/A N/A N/A self assertTrue N/A N/A required_headers issubset N/A set auth_parts N/A N/A N/A self assertEqual "token_key" N/A auth_parts N/A oauth_token N/A N/A N/A self assertEqual "consumer_key" N/A auth_parts N/A oauth_consumer_key N/A N/A N/A self assertEqual "consumer_secret%26token_secret" N/A auth_parts N/A oauth_signature N/A N/A N/A testutils ConfPatcher maas_oauth_consumer_key consumer_key N/A N/A testutils ConfPatcher maas_oauth_consumer_secret consumer_secret N/A N/A testutils ConfPatcher maas_oauth_token_key token_key N/A N/A testutils ConfPatcher maas_oauth_token_secret token_secret test_get_data N/A N/A self mock_get_response mock_Request mock_get_oauth_headers N/A N/A N/A N/A N/A testutils ConfPatcher maas_metadata_url 196.254.196.254 N/A N/A fake_path N/A N/A N/A os path join fake path N/A N/A mock_get_oauth_headers return_value fake headers N/A response N/A N/A N/A self _maasservice _get_data path fake_path N/A norm_path N/A N/A posixpath join N/A CONF maas_metadata_url fake_path N/A N/A N/A mock_get_oauth_headers assert_called_once_with norm_path N/A N/A N/A mock_Request assert_called_once_with norm_path headers fake headers N/A N/A N/A mock_get_response assert_called_once_with N/A mock_Request N/A N/A N/A self assertEqual N/A N/A N/A mock_get_response return_value read return_value response N/A N/A N/A mock patch cloudbaseinit.metadata.services.maasservice.MaaSHttpService._get_oauth_headers N/A N/A mock patch six.moves.urllib.request.Request N/A N/A mock patch cloudbaseinit.metadata.services.maasservice.MaaSHttpService._get_response test_get_host_name N/A N/A self mock_get_cache_data N/A N/A N/A response N/A N/A N/A self _maasservice get_host_name N/A N/A N/A mock_get_cache_data assert_called_once_with N/A %s/meta-data/local-hostname N/A N/A self _maasservice _metadata_version decode True N/A N/A N/A self assertEqual N/A mock_get_cache_data return_value response N/A N/A N/A mock patch cloudbaseinit.metadata.services.maasservice.MaaSHttpService._get_cache_data test_get_instance_id N/A N/A self mock_get_cache_data N/A N/A N/A response N/A N/A N/A self _maasservice get_instance_id N/A N/A N/A mock_get_cache_data assert_called_once_with N/A %s/meta-data/instance-id N/A N/A self _maasservice _metadata_version decode True N/A N/A N/A self assertEqual N/A mock_get_cache_data return_value response N/A N/A N/A mock patch cloudbaseinit.metadata.services.maasservice.MaaSHttpService._get_cache_data test_get_public_keys N/A N/A self mock_get_cache_data N/A N/A N/A public_keys N/A fake key 1 fake key 2 N/A public_key N/A N/A N/A join public_keys N/A N/A mock_get_cache_data return_value public_key N/A response N/A N/A N/A self _maasservice get_public_keys N/A N/A N/A mock_get_cache_data assert_called_with N/A %s/meta-data/public-keys N/A N/A self _maasservice _metadata_version decode True N/A N/A N/A self assertEqual public_keys response N/A N/A N/A mock patch cloudbaseinit.metadata.services.maasservice.MaaSHttpService._get_cache_data test_get_client_auth_certs N/A N/A self mock_get_cache_data N/A N/A N/A certs N/A N/A N/A {begin}
{cert}
{end} format begin N/A x509constants PEM_HEADER end N/A x509constants PEM_FOOTER cert cert N/A cert N/A first cert second cert N/A N/A mock_get_cache_data return_value N/A N/A N/A join certs N/A response N/A N/A N/A self _maasservice get_client_auth_certs N/A N/A N/A mock_get_cache_data assert_called_with N/A %s/meta-data/x509 N/A N/A self _maasservice _metadata_version decode True N/A N/A N/A self assertEqual certs response N/A N/A N/A mock patch cloudbaseinit.metadata.services.maasservice.MaaSHttpService._get_cache_data test_get_user_data N/A N/A self mock_get_cache_data N/A N/A N/A response N/A N/A N/A self _maasservice get_user_data N/A N/A N/A mock_get_cache_data assert_called_once_with N/A %s/user-data N/A N/A self _maasservice _metadata_version N/A N/A N/A self assertEqual N/A mock_get_cache_data return_value response N/A N/A N/A mock patch cloudbaseinit.metadata.services.maasservice.MaaSHttpService._get_cache_data N/A