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

remove spaces that break resulting yaml #336

Merged
merged 1 commit into from Jul 19, 2017
Merged

remove spaces that break resulting yaml #336

merged 1 commit into from Jul 19, 2017

Conversation

ckolos
Copy link
Contributor

@ckolos ckolos commented Jul 18, 2017

As written in master, the yaml produced by the docker_daemon.yaml.erb results in an agent stack trace on configtest. After investigation, it seems that there are too many spaces being added in the tag: element and that results in invalid yaml.

[root@xxxx agent-conf.d]# /etc/init.d/datadog-agent configtest                                                  
2017-07-18 16:13:00,995 | ERROR | dd.collector | utils.dockerutil(dockerutil.py:138) | Docker check configuration file is invalid. The docker check and other Docker related components will not work.
Traceback (most recent call last):
  File "/opt/datadog-agent/agent/utils/dockerutil.py", line 134, in get_check_config
    check_config = check_yaml(conf_path)
  File "/opt/datadog-agent/agent/util.py", line 106, in check_yaml
    check_config = yaml.load(f.read(), Loader=yLoader)
  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/yaml/__init__.py", line 71, in load
    return loader.get_single_data()
  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/yaml/constructor.py", line 37, in get_single_data
    node = self.get_single_node()
  File "_yaml.pyx", line 707, in _yaml.CParser.get_single_node (ext/_yaml.c:8308)
  File "_yaml.pyx", line 725, in _yaml.CParser._compose_document (ext/_yaml.c:8581)
  File "_yaml.pyx", line 776, in _yaml.CParser._compose_node (ext/_yaml.c:9306)
  File "_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node (ext/_yaml.c:10838)
  File "_yaml.pyx", line 774, in _yaml.CParser._compose_node (ext/_yaml.c:9284)
  File "_yaml.pyx", line 851, in _yaml.CParser._compose_sequence_node (ext/_yaml.c:10311)
  File "_yaml.pyx", line 776, in _yaml.CParser._compose_node (ext/_yaml.c:9306)
  File "_yaml.pyx", line 892, in _yaml.CParser._compose_mapping_node (ext/_yaml.c:10868)
  File "_yaml.pyx", line 905, in _yaml.CParser._parse_next_event (ext/_yaml.c:11045)
ParserError: while parsing a block mapping
  in "<byte string>", line 30, column 5
did not find expected key
  in "<byte string>", line 82, column 7
2017-07-18 16:13:00,996 | ERROR | dd.collector | utils.dockerutil(dockerutil.py:146) | No instance was found in the docker check configuration. Docker related collection will not work.
disk.yaml is valid
network.yaml is valid
docker_daemon.yaml contains errors:
    while parsing a block mapping
  in "<byte string>", line 30, column 5
did not find expected key
  in "<byte string>", line 82, column 7
ntp.yaml is valid
Fix the invalid yaml files above in order to start the Datadog agent. A useful external tool for yaml parsing can be found at http://yaml-online-parser.appspot.com/
[root@xxxx agent-conf.d]# egrep -v "^$|#" /etc/dd-agent/conf.d/docker_daemon.yaml                               
init_config:                                                                                                              
instances:
    url: unix://var/run/docker.sock
      tags:
          - app:foo
          - type:bar

After application of patch and re-apply:

[root@xxxx agent-conf.d]# /etc/init.d/datadog-agent configtest                                                                                          
disk.yaml is valid
network.yaml is valid
docker_daemon.yaml is valid
ntp.yaml is valid
All yaml files passed. You can now run the Datadog agent.
[root@xxxx agent-conf.d]# egrep -v "^$|#" /etc/dd-agent/conf.d/docker_daemon.yaml
init_config:
instances:
    url: unix://var/run/docker.sock
    tags:
      - app:foo
      - type:bar

@ckolos
Copy link
Contributor Author

ckolos commented Jul 18, 2017

filed #337

Copy link
Member

@truthbk truthbk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this! Merging! :shipit:

@truthbk truthbk merged commit 024f128 into DataDog:master Jul 19, 2017
cegeka-jenkins pushed a commit to cegeka/puppet-datadog_agent that referenced this pull request Jan 31, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants