This message was deleted.
# opal
s
This message was deleted.
👀 2
o
I think it is only sent in diff bundles @Oded Bd - I think you should know this best?
o
@Abdullah Al Rifat please share you opal client logs, I specifically wants to see logs with this line: "Refetching policy ...."
a
Copy code
2023-01-12 12:46:22.368 | 27 | DEBUG    | websockets.legacy.protocol:read_frame:1177 - < TEXT '{"request": {"method": "notify", "arguments": {...ff"}, "response": null}' [476 bytes]
2023-01-12 12:46:22.369 | 27 | DEBUG    | fastapi_websocket_rpc.rpc_channel:on_request:306 - Handling RPC request - {'request': RpcRequest(method='notify', arguments={'subscription': {'id': '514534282a9940fea2c4aa89b9d78b05', 'subscriber_id': '3adb29ee239b4d3483d85bba2add93b2', 'topic': 'policy:.', 'notifier_id': None}, 'data': {'old_policy_hash': '34b11c7998a122bf29795132af5e6740b510da93', 'new_policy_hash': '24161f60543b9d0c319faaab4f8966de7e6595fb', 'changed_directories': ['.', 'hot', 'hot/example', 'hot/example/data']}}, call_id='1b3536d15034414cb1bc3d057116daff'), 'channel': 'b91d789e03bb4c058d397ef100932f82'}
2023-01-12 12:46:22.369 | 27 | INFO     | fastapi_websocket_pubsub.rpc_event_methods:notify:87 - Received notification of event
2023-01-12 12:46:22.369 | 27 | INFO     | opal_client.policy.updater:_update_policy_callback:134 - Received policy update: topic=policy:., message={'old_policy_hash': '34b11c7998a122bf29795132af5e6740b510da93', 'new_policy_hash': '24161f60543b9d0c319faaab4f8966de7e6595fb', 'changed_directories': ['.', 'hot', 'hot/example', 'hot/example/data']}
2023-01-12 12:46:22.370 | 27 | INFO     | opal_client.policy.updater:update_policy:259 - Refetching policy code (delta bundle), base hash: '34b11c7998a122bf29795132af5e6740b510da93'
2023-01-12 12:46:22.370 | 27 | INFO     | opal_client.policy.fetcher:_fetch_policy_bundle:90 - Fetching policy bundle from <http://opal.server.tools.hk.agoda.is/policy>
2023-01-12 12:46:22.622 | 27 | INFO     | opal_client.policy.fetcher:_fetch_policy_bundle:117 - Fetched valid bundle, id: 24161f60543b9d0c319faaab4f8966de7e6595fb
2023-01-12 12:46:22.623 | 27 | INFO     | opal_client.policy.fetcher:_fetch_policy_bundle:90 - Fetching policy bundle from <http://opal.server.tools.hk.agoda.is/policy>
2023-01-12 12:46:22.895 | 27 | INFO     | opal_client.policy.fetcher:_fetch_policy_bundle:117 - Fetched valid bundle, id: 24161f60543b9d0c319faaab4f8966de7e6595fb
2023-01-12 12:46:22.896 | 27 | INFO     | opal_client.policy.updater:update_policy:293 - got policy bundle (delta): '34b11c7998a122bf29795132af5e6740b510da93' -> '24161f60543b9d0c319faaab4f8966de7e6595fb'
2023-01-12 12:46:22.898 | 27 | DEBUG    | charset_normalizer.api:from_bytes:78 - Encoding detection on empty bytes, assuming utf_8 intention.
2023-01-12 12:46:22.899 | 27 | INFO     | opal_client.policy.updater:update_policy:326 - reverting changes
2023-01-12 12:46:22.901 | 27 | DEBUG    | charset_normalizer.api:from_bytes:78 - Encoding detection on empty bytes, assuming utf_8 intention.
2023-01-12 12:46:22.904 | 27 | DEBUG    | websockets.legacy.protocol:write_frame_sync:1183 - > TEXT '{"request": null, "response": {"result": "None"...414cb1bc3d057116daff"}}' [118 bytes]
2023-01-12 12:46:23.315 | 27 | INFO     | opal_client.opa.runner:_run_opa_until_terminated:118 - Running OPA inline: opa run --server --addr=:8181 --authentication=off --authorization=off --log-level=info
2023-01-12 12:46:23.360 | 27 | INFO     | opal_client.opa.runner:_run_opa_until_terminated:149 - OPA exited with return code: 1
2023-01-12 12:46:24.333 | 27 | INFO     | opal_client.opa.runner:_run_start_callbacks:184 - Running OPA rehydration callbacks
2023-01-12 12:46:24.334 | 27 | INFO     | opal_client.policy.updater:update_policy:251 - full update was forced (ignoring stored hash if exists)
2023-01-12 12:46:24.334 | 27 | INFO     | opal_client.policy.updater:update_policy:257 - Refetching policy code (full bundle)
2023-01-12 12:46:24.335 | 27 | INFO     | opal_client.policy.fetcher:_fetch_policy_bundle:90 - Fetching policy bundle from <http://opal.server.tools.hk.agoda.is/policy>
2023-01-12 12:46:24.336 | 27 | INFO     | opal_client.data.updater:get_base_policy_data:194 - Performing data configuration, reason: policy store rehydration
2023-01-12 12:46:24.336 | 27 | INFO     | opal_client.data.updater:get_policy_data_config:169 - Getting data-sources configuration from '<http://opal.server.tools.hk.agoda.is/data/config>'
2023-01-12 12:46:24.657 | 27 | INFO     | opal_client.data.updater:trigger_data_update:152 - Triggering data update with id: 39d4ca14ac7d4e7f9bfd0b16947dce4d
2023-01-12 12:46:24.657 | 27 | INFO     | opal_client.data.updater:update_policy_data:327 - Fetching policy data
2023-01-12 12:46:24.657 | 27 | INFO     | opal_client.data.fetcher:handle_url:67 - Fetching data from url: <http://opal_server:7002/policy-data>
2023-01-12 12:46:24.658 | 27 | DEBUG    | opal_common.fetcher.providers.http_fetch_provider:_fetch_:81 - HttpFetchProvider fetching from <http://opal_server:7002/policy-data>
2023-01-12 12:46:24.662 | 27 | INFO     | opal_client.data.updater:update_policy_data:393 - Saving fetched data to policy-store: source url='<http://opal_server:7002/policy-data>', destination path='/'
2023-01-12 12:46:24.664 | 27 | DEBUG    | charset_normalizer.api:from_bytes:78 - Encoding detection on empty bytes, assuming utf_8 intention.
2023-01-12 12:46:24.740 | 27 | INFO     | opal_client.opa.runner:_run_opa_until_terminated:118 - Running OPA inline: opa run --server --addr=:8181 --authentication=off --authorization=off --log-level=info
2023-01-12 12:46:24.780 | 27 | INFO     | opal_client.opa.runner:_run_opa_until_terminated:149 - OPA exited with return code: 1
2023-01-12 12:46:24.854 | 27 | INFO     | opal_client.policy.fetcher:_fetch_policy_bundle:117 - Fetched valid bundle, id: 24161f60543b9d0c319faaab4f8966de7e6595fb
2023-01-12 12:46:24.855 | 27 | INFO     | opal_client.policy.fetcher:_fetch_policy_bundle:90 - Fetching policy bundle from <http://opal.server.tools.hk.agoda.is/policy>
2023-01-12 12:46:25.193 | 27 | INFO     | opal_client.policy.fetcher:_fetch_policy_bundle:117 - Fetched valid bundle, id: 24161f60543b9d0c319faaab4f8966de7e6595fb
2023-01-12 12:46:25.194 | 27 | INFO     | opal_client.policy.updater:update_policy:280 - Got policy bundle with 20 rego files, 13 data files, commit hash: '24161f60543b9d0c319faaab4f8966de7e6595fb'
when i am fetching a bundle inside that bundle something like this bundle.old_hash should have contain old_commit hash right? but i am getting null here, let me log it i will post here
Copy code
<http://logger.info|logger.info>("Fetched valid bundle, id: {id} with old_hash: {old_hash}", id=bundle.hash, old_hash=bundle.old_hash)
i got this
Copy code
2023-01-12 12:54:54.188 | 7 | INFO     | opal_client.policy.fetcher:_fetch_policy_bundle:118 - Fetched valid bundle, id: 24161f60543b9d0c319faaab4f8966de7e6595fb with old_hash: None
o
You can see in the lines 4-5 of the logs you sent me the lines:
Copy code
2023-01-12 12:46:22.369 | 27 | INFO     | opal_client.policy.updater:_update_policy_callback:134 - Received policy update: topic=policy:., message={'old_policy_hash': '34b11c7998a122bf29795132af5e6740b510da93', 'new_policy_hash': '24161f60543b9d0c319faaab4f8966de7e6595fb', 'changed_directories': ['.', 'hot', 'hot/example', 'hot/example/data']}
2023-01-12 12:46:22.370 | 27 | INFO     | opal_client.policy.updater:update_policy:259 - Refetching policy code (delta bundle), base hash: '34b11c7998a122bf29795132af5e6740b510da93'
And in line 10
Copy code
2023-01-12 12:46:22.896 | 27 | INFO     | opal_client.policy.updater:update_policy:293 - got policy bundle (delta): '34b11c7998a122bf29795132af5e6740b510da93' -> '24161f60543b9d0c319faaab4f8966de7e6595fb'
A successful delta bundle
a
@Oded Bd if server restarts it does it serve old_hash? in my case i have seen if i restart the server the old_hash is null or same , ex. edb1dc83a4f70aff2271963f4c38f16ab0803066 this is the last commit hash in my repo, now after restart if i pull http://localhost:7002/policy?base_hash=edb1dc83a4f70aff2271963f4c38f16ab0803066 it is giving me
{
"manifest": [],
"hash": "edb1dc83a4f70aff2271963f4c38f16ab0803066",
"old_hash": "edb1dc83a4f70aff2271963f4c38f16ab0803066",
"data_modules": [],
"policy_modules": [],
"deleted_files": null
}
is that behaviour normal?
o
I think so, after restart you start fresh If you want to change this behavior you can talk to @Asaf Cohen / @Or Weis and maybe consider contributing to the OSS