Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to parse multiple document in yaml file #66

Open
Vikash082 opened this issue Apr 3, 2019 · 1 comment
Open

Fail to parse multiple document in yaml file #66

Vikash082 opened this issue Apr 3, 2019 · 1 comment

Comments

@Vikash082
Copy link

I have yaml file with multiple document . I am trying to read a value from one of the document and I am getting this error while trying to access "spec.selector.name" .

Below is the yaml:

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: epgs.aci.aw
spec:
  group: aci.aw
  names:
    kind: Epg
    listKind: EpgList
    plural: epgs
  scope: Namespaced
  version: v1
---
apiVersion: v1
kind: Service
metadata:
  name: ep-registry
  namespace: kube-system
  labels:
    app: gbpserver
spec:
  clusterIP: 10.96.0.2
  ports:
  - port: 14443
    targetPort: 14443
  selector:
    name: aci-containers-controller

Error:

Traceback (most recent call last):
  File "/tmp/ansible_yedit_payload_v_m8fh76/__main__.py", line 499, in load
AttributeError: module 'yaml' has no attribute 'RoundTripLoader'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/ansible_yedit_payload_v_m8fh76/__main__.py", line 501, in load
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 94, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 72, in load
    return loader.get_single_data()
  File "/usr/lib/python3/dist-packages/yaml/constructor.py", line 35, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 43, in get_single_node
    event.start_mark)
yaml.composer.ComposerError: expected a single document in the stream
  in "<unicode string>", line 1, column 1:
    apiVersion: apiextensions.k8s.io ... 
    ^
but found another document
  in "<unicode string>", line 14, column 1:
    ---
    ^

Is there a way to resolve this ?

@SaimonWoidig
Copy link

Got this issue aswell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants