Skip to content

Instantly share code, notes, and snippets.

@moolitayer
Created April 24, 2017 07:59
Show Gist options
  • Save moolitayer/e5e7d0cf910a05fa5a7f400f0a115f2f to your computer and use it in GitHub Desktop.
Save moolitayer/e5e7d0cf910a05fa5a7f400f0a115f2f to your computer and use it in GitHub Desktop.
$ cat /tmp/container-status.json
{
"name": "registry",
"state": {},
"lastState": {
"terminated": {
"exitCode": 137,
"reason": "Error",
"startedAt": "2017-02-08T11:31:45Z",
"finishedAt": "2017-03-26T07:46:03Z",
"containerID": "docker://3bc373bb1ab4e25351e50364c5af0f7e49e0a37be291795d908e602223f9661e"
}
},
"ready": true,
"restartCount": 2,
"image": "openshift/origin-docker-registry:v1.4.0-alpha.1",
"imageID": "docker://sha256:c9e453bd2e055aad9283f2fd6d51e309ef871fc6c27bc6060e366bf066b33bed",
"containerID": "docker://77fe0206d0f9b651cc501ddc0318816189d6aca7d8013066446130b18bf8cb69"
}
# open console
$ cd /var/www/miq/vmdb/
$ source /etc/default/evm
$ bin/rails c
# run parsing
require "recursive-open-struct"
> file = File.read("/tmp/container-status.json")
> data_hash = JSON.parse(file)
> ros = RecursiveOpenStruct.new(data_hash)
> ManageIQ::Providers::Kubernetes::ContainerManager::RefreshParser.new.parse_container(ros, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment