One of our customers also stumbled upon this bug. I have the "db.yaml" file from the customer's environment and can confirm that "charm-origin.platform.os" field is missing in several applications. I came up with the following "yq" [1] one-liner to find which particular applications do not have the ".os" field:
Hello,
One of our customers also stumbled upon this bug. I have the "db.yaml" file from the customer's environment and can confirm that "charm- origin. platform. os" field is missing in several applications. I came up with the following "yq" [1] one-liner to find which particular applications do not have the ".os" field:
------- ------- ------- ------- ------- ------- ------- ------- -----
cat dump.yaml | yq '.applications[] | select( .["charm- origin" ].platform | has("os") == false) | ._id,.[ "charm- origin" ].platform'
Running this command against the dump-db. yaml/dump- db-working. yaml files submitted by @Joakim results in following output:
12:21 ❯ cat dump-db.yaml | yq '.applications[] | select( .["charm- origin" ].platform | has("os") == true) | ._id,.[ "charm- origin" ].platform' 4869-4490- 8056-ddd76032d9 c1:prometheus" .["charm- origin" ].platform | has("os") == false) | ._id,.[ "charm- origin" ].platform' 4869-4490- 8056-ddd76032d9 c1:polkadot"
"ba12e8ea-
{
"architecture": "amd64",
"os": "ubuntu",
"series": "focal"
}
/tmp 109ms
12:21 ❯ cat dump-db.yaml | yq '.applications[] | select(
"ba12e8ea-
{}
------- ------- ------- ------- ------- ------- ------- ------- -----
The application "polkadot" lacks the "platform" key completely, as can be seen above. As for the working db.yaml file, this is not the case:
------- ------- ------- ------- ------- ------- ------- ------- -----
12:28 ❯ cat dump-db- working. yaml | yq '.applications[] | select( .["charm- origin" ].platform | has("os") == true) | ._id,.[ "charm- origin" ].platform' e590-494e- 8f0f-c193ba0710 1a:polkadot" e590-494e- 8f0f-c193ba0710 1a:prometheus"
"a68e2aae-
{
"architecture": "amd64",
"os": "ubuntu",
"series": "focal"
}
"a68e2aae-
{
"architecture": "amd64",
"os": "ubuntu",
"series": "focal"
}
12:28 ❯ cat dump-db- working. yaml | yq '.applications[] | select( .["charm- origin" ].platform | has("os") == false) | ._id,.[ "charm- origin" ].platform' ------- ------- ------- ------- ------- ------- ------- -----
12:28 ❯
-------
[1]: sudo pip3 install yq