Comment 8 for bug 1999640

Revision history for this message
Mustafa Kemal Gilor (mustafakemalgilor) wrote :

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'
"ba12e8ea-4869-4490-8056-ddd76032d9c1:prometheus"
{
  "architecture": "amd64",
  "os": "ubuntu",
  "series": "focal"
}
 /tmp 109ms
 12:21 ❯ cat dump-db.yaml | yq '.applications[] | select(.["charm-origin"].platform | has("os") == false) | ._id,.["charm-origin"].platform'
"ba12e8ea-4869-4490-8056-ddd76032d9c1:polkadot"
{}

-------------------------------------------------------------

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'
"a68e2aae-e590-494e-8f0f-c193ba07101a:polkadot"
{
  "architecture": "amd64",
  "os": "ubuntu",
  "series": "focal"
}
"a68e2aae-e590-494e-8f0f-c193ba07101a:prometheus"
{
  "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