Project: Chef InSpec (Provisioning / Security & Compliance)
File: podman_pod.md

+++ title = "podman_pod resource" draft = false gh_repo = "inspec" platform = "unix" [menu] [menu.inspec] title = "podman_pod" identifier = "inspec/resources/os/podmanpod.md podmanpod resource" parent = "inspec/resources/os" +++ Use the `podman_pod` Chef InSpec audit resource to test the properties of a pod on Podman. This resource is distributed with Chef InSpec and is automatically available for use. Use the `podman_pod` Chef InSpec audit resource to test the properties of a pod on Podman. ```ruby describe podman_pod("nginx-frontend") do it { should exist } its("id") { should eq "fcfe4d471cfface0d1b39bce23af7d31ab8736cd68c0360ade0b4afe364f79d4" } its("name") { should eq "nginx-frontend" } its("created_at") { should eq "2022-07-14T15:47:47.978078124+05:30" } its("create_command") { should include "new:nginx-frontend" } its("state") { should eq "Running" } end ``` where: `'nginx-frontend'` is the name of the pod. Pod ID and Pod names are valid parameters accepted by `podman_pod`. `'id'`, `'name'`, `'createdat'`, `'createcommand'`, and `'state'`, are properties of this resource to fetch the respective value of the podman pod. `exist` is a matcher of this resource. Properties of the resources are: `'id'`, `'name'`, `'createdat'`, `'createcommand'`, `'state'`, `'hostname'`, `'createcgroup'`, `'cgroupparent'`, `cgrouppath`, `'createinfra'`, `'infracontainerid'`, `'infraconfig'`, `'sharednamespaces'`, `'num_containers'`, and `'containers'` The `id` property returns the id of the pod. ```ruby its("id") { should eq "fcfe4d471cfface0d1b39bce23af7d31ab8736cd68c0360ade0b4afe364f79d4" } ``` The `name` property returns the name of the pod. ```ruby its("name") { should eq "nginx-frontend" } ``` The `created_at` property returns the creation date of the pod. ```ruby its("created_at") { should eq "2022-07-14T15:47:47.978078124+05:30" } ``` The `create_command` property returns an array of commands used to create the pod. ```ruby its("create_command") { should include "new:nginx-frontend" } ``` The `state` property returns the state of the pod. ```ruby its("state") { should eq "Running" } ``` The `hostname` property returns the hostname of the pod. ```ruby its("hostname") { should eq "" } ``` The `create_cgroup` property returns a boolean value for cgroup creation of the

```ruby its("create_cgroup") { should eq true } ``` The `cgroup_parent` property returns the name of the cgroup parent of the pod. ```ruby its("cgroup_parent") { should eq "user.slice" } ``` The `cgroup_path` property returns the path of the cgroup parent of the pod. ```ruby its("cgrouppath") { should eq "user.slice/user-libpodpod_fcfe4d471cfface0d1b39bce23af7d31ab8736cd68c0360ade0b4afe364f79d4.slice" } ``` The `create_infra` property returns a boolean value for the pod infra creation. ```ruby its("create_infra") { should eq true } ``` The `infracontainerid` property returns the infra container ID of the pod. ```ruby its("infracontainerid") { should eq "727538044b32a165934729dc2d47d9d5e981b6496aebfad7de470f7e76ea4251" } ``` The `infra_config` property returns a hash of the infra configuration of the pod. ```ruby its("infra_config") { should include "DNSOption" } ``` The `shared_namespaces` property returns an array of shared namespaces of the pod. ```ruby its("shared_namespaces") { should include "ipc" } ``` The `num_containers` property returns the number of containers in the pod. ```ruby its("num_containers") { should eq 2 } ``` The `containers` property returns an array of hashes about the information of containers in the pod. ```ruby its("containers") { should_not be nil } ``` {{< readfile file="content/inspec/reusable/md/inspecmatcherslink.md" >}} This resource has the following special matchers. The `exist` matcher tests if the pod is available on Podman. ```ruby it { should exist } ``` ```ruby describe podman_pod("nginx-frontend") do it { should exist } its("id") { should eq "fcfe4d471cfface0d1b39bce23af7d31ab8736cd68c0360ade0b4afe364f79d4" } its("name") { should eq "nginx-frontend" } its("created_at") { should eq "2022-07-14T15:47:47.978078124+05:30" } its("create_command") { should include "new:nginx-frontend" } its("state") { should eq "Running" } its("hostname") { should eq "" } its("create_cgroup") { should eq true } its("cgroup_parent") { should eq "user.slice" } its("cgrouppath") { should eq "user.slice/user-libpodpod_fcfe4d471cfface0d1b39bce23af7d31ab8736cd68c0360ade0b4afe364f79d4.slice" } its("create_infra") { should eq true } its("infracontainerid") { should eq "727538044b32a165934729dc2d47d9d5e981b6496aebfad7de470f7e76ea4251" } its("infra_config") { should include "DNSOption" } its("shared_namespaces") { should include "ipc" } its("num_containers") { should eq 2 } its("containers") { should_not be nil } end ``` ```ruby describe podmanpod("nonexisting_pod") do it { should_not exist } end ```