OCP.exec_oc_cmd("describe pod name") returns:
/home/ec2-user/venv/lib/python3.7/site-packages/kubernetes/config/kube_config.py:496: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
config_dict=yaml.load(f),
Traceback (most recent call last):
File "get_ip_addrs.py", line 53, in
print(get_ip_addrs())
File "get_ip_addrs.py", line 46, in get_ip_addrs
OCP.exec_oc_cmd(oc_cmd)
File "/home/ec2-user/ocs-ci/ocs/ocp.py", line 66, in exec_oc_cmd
return munchify(yaml.safe_load(out))
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/init.py", line 162, in safe_load
return load(stream, SafeLoader)
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/init.py", line 114, in load
return loader.get_single_data()
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/constructor.py", line 41, in get_single_data
node = self.get_single_node()
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/composer.py", line 127, in compose_mapping_node
while not self.check_event(MappingEndEvent):
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key
if self.check_token(KeyToken):
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/scanner.py", line 116, in check_token
self.fetch_more_tokens()
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/scanner.py", line 223, in fetch_more_tokens
return self.fetch_value()
File "/home/ec2-user/venv/lib/python3.7/site-packages/yaml/scanner.py", line 579, in fetch_value
self.get_mark())
yaml.scanner.ScannerError: mapping values are not allowed here
in "", line 10, column 37:
Annotations: openshift.io/scc: rook-ceph
==============================================================
When I tried something invalid, I got the following:
home/ec2-user/venv/lib/python3.7/site-packages/kubernetes/config/kube_config.py:496: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
config_dict=yaml.load(f),
CMD error:: Error: unknown command "xxxxxxx" for "oc"
Run 'oc --help' for usage.
Traceback (most recent call last):
File "get_ip_addrs.py", line 53, in
print(get_ip_addrs())
File "get_ip_addrs.py", line 46, in get_ip_addrs
OCP.exec_oc_cmd(oc_cmd)
File "/home/ec2-user/ocs-ci/ocs/ocp.py", line 65, in exec_oc_cmd
out = run_cmd(cmd=oc_cmd)
File "/home/ec2-user/ocs-ci/utility/utils.py", line 654, in run_cmd
f"Error during execution of command: {cmd}"
ocs.exceptions.CommandFailed: Error during execution of command: ['oc', '-n', 'openshift-storage', '--kubeconfig', '/tmp/ocs-ci-cluster-ec2-user-30031/auth/kubeconfig', 'xxxxxxx', 'describe', 'pod', 'rook-ceph-agent-5h67j']
==============================================================
So I tried running the valid corresponding command from the shell and it worked:
oc -n openshift-storage --kubeconfig /tmp/ocs-ci-cluster-ec2-user-30031/auth/kubeconfig describe pod rook-ceph-agent-5h67j
Name: rook-ceph-agent-5h67j
Namespace: openshift-storage
Priority: 0
PriorityClassName:
Node: ip-10-0-166-194.us-east-2.compute.internal/10.0.166.194
Start Time: Tue, 28 May 2019 22:44:03 +0000
Labels: app=rook-ceph-agent
controller-revision-hash=6848b56bb
pod-template-generation=1
Annotations: openshift.io/scc: rook-ceph
Status: Running
IP: 10.0.166.194
Controlled By: DaemonSet/rook-ceph-agent
Containers:
rook-ceph-agent:
Container ID: cri-o://ba7d0de2fd216359bd7cabc5ec2f21ef445defbca3ef90dcc6e72c4ec8388f30
Image: quay.io/rhceph-dev/rook
Image ID: quay.io/rhceph-dev/rook@sha256:ccad618bedd562354beef8a6452510e50bfa1da9c30e0360e4ce75f06a84a8d7
Port:
Host Port:
Args:
ceph
agent
State: Running
Started: Tue, 28 May 2019 22:45:05 +0000
Ready: True
Restart Count: 0
Environment:
POD_NAMESPACE: openshift-storage (v1:metadata.namespace)
NODE_NAME: (v1:spec.nodeName)
AGENT_MOUNT_SECURITY_MODE: Any
ROOK_ENABLE_SELINUX_RELABELING: true
ROOK_ENABLE_FSGROUP: true
Mounts:
/dev from dev (rw)
/flexmnt from flexvolume (rw)
/lib/modules from libmodules (rw)
/sys from sys (rw)
/var/run/secrets/kubernetes.io/serviceaccount from rook-ceph-system-token-w9kxj (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
flexvolume:
Type: HostPath (bare host directory volume)
Path: /etc/kubernetes/kubelet-plugins/volume/exec
HostPathType:
dev:
Type: HostPath (bare host directory volume)
Path: /dev
HostPathType:
sys:
Type: HostPath (bare host directory volume)
Path: /sys
HostPathType:
libmodules:
Type: HostPath (bare host directory volume)
Path: /lib/modules
HostPathType:
rook-ceph-system-token-w9kxj:
Type: Secret (a volume populated by a Secret)
SecretName: rook-ceph-system-token-w9kxj
Optional: false
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/disk-pressure:NoSchedule
node.kubernetes.io/memory-pressure:NoSchedule
node.kubernetes.io/network-unavailable:NoSchedule
node.kubernetes.io/not-ready:NoExecute
node.kubernetes.io/unreachable:NoExecute
node.kubernetes.io/unschedulable:NoSchedule
Events:
I am wondering if the fields at the end with colons and no spaces are confusing things.