Skip to content

Conversation

@stu-spp
Copy link
Contributor

@stu-spp stu-spp commented Jan 7, 2026

Thoughts on performing metadata_gather prior to running the post-fash.sh customization script?

We have been running like this in production so that we can reliably access the metadata from the database for the currently provisioned device during the post flash customization phase of provisioning.

This affords us the ability query the local manufacturing database during post-flash customization, and then send that data to our cloud database, thereby automatically registering the new device with our production backend.

Here is a simplified excerpt from our production post-flash.sh illustrating the above:

log_info "Querying local manufacturing database at http://localhost:3142/api/v2/manufacturing"
LOCAL_DB_RESPONSE=$(curl -s -w "\n%{http_code}" "http://localhost:3142/api/v2/manufacturing")
LOCAL_DB_BODY=$(echo "$LOCAL_DB_RESPONSE" | sed '$d')
MFG_DATA_JSON=$(echo "$LOCAL_DB_BODY" | jq 'map(select(.serial == "'"$TARGET_DEVICE_SERIAL"'")) | .[0]')
log_info "Posting device to cloud backend..."
post_to_backend "$MFG_DATA_JSON" "$ENV"

@tdewey-rpi
Copy link
Collaborator

Happy to accept this, and in retrospect is seems obvious as an ordering change. Thanks for the PR, @stu-spp!

@tdewey-rpi tdewey-rpi merged commit 870dffd into raspberrypi:main Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants