CentOS-PaaS-SIG / linchpin

ansible based multicloud orchestrator
http://linchpin.readthedocs.io
GNU General Public License v3.0
115 stars 70 forks source link

Linchpin throwing : ValueError: Invalid control character at: line 1 column 251210 #1329

Closed maveric-tellrv closed 5 years ago

maveric-tellrv commented 5 years ago

Describe the bug I am getting bellow error after sometime

(.linchpin) [rovyas@workstation openstack]$ linchpin -p PinFile_el7_rpm up

Traceback (most recent call last):
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/bin/linchpin", line 10, in <module>
    sys.exit(runcli())
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/linchpin/shell/__init__.py", line 307, in up
    env_vars=env_vars)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/linchpin/cli/__init__.py", line 395, in lp_up
    tx_id=tx_id)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/linchpin/cli/__init__.py", line 585, in _execute_action
    run_id=run_id)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/linchpin/cli/__init__.py", line 762, in _execute
    tx_id=tx_id)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/linchpin/__init__.py", line 514, in do_action
    rundb_id = rundb.init_table(target)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/linchpin/rundb/basedb.py", line 25, in init_table
    return self.driver.init_table(table)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/linchpin/rundb/tinyrundb.py", line 13, in func_wrapper
    args[0]._opendb()
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/linchpin/rundb/tinyrundb.py", line 32, in _opendb
    default_table=self.default_table)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/tinydb/database.py", line 165, in __init__
    self._table = self.table(default_table)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/tinydb/database.py", line 196, in table
    table = table_class(self._cls_storage_proxy(self._storage, name), name, **options)
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/tinydb/database.py", line 302, in __init__
    data = self._read()
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/tinydb/database.py", line 409, in _read
    return self._storage.read()
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/tinydb/database.py", line 90, in read
    raw_data = self._storage.read() or {}
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/tinydb/middlewares.py", line 96, in read
    self.cache = self.storage.read()
  File "/home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/tinydb/storages.py", line 108, in read
    return json.load(self._handle)
  File "/usr/lib64/python2.7/json/__init__.py", line 291, in load
    **kw)
  File "/usr/lib64/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", line 380, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Invalid control character at: line 1 column 251210 (char 251209)

To Reproduce

Desktop (please complete the following information):

(.linchpin) [rovyas@workstation openstack]$ linchpin --version 
linchpin version 1.8.1
(.linchpin) [rovyas@workstation openstack]$ ansible --version 
ansible 2.8.5
  config file = None
  configured module search path = [u'/home/rovyas/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/lib/python2.7/site-packages/ansible
  executable location = /home/rovyas/workspace/RHCERT_BUILDS_el8@2/testscripts/src/script/linchpin/openstack/.linchpin/bin/ansible
  python version = 2.7.16 (default, Apr 30 2019, 15:54:43) [GCC 9.0.1 20190312 (Red Hat 9.0.1-0.10)]

SAmple Yaml File:

simple:
  topology:
    topology_name: simple
    resource_groups:
      - resource_group_name: os_simple
        resource_group_type: openstack
        resource_definitions:
          - name: "RHEL7"
            role: os_server
            flavor: m1.medium
            keypair: fedora
            count: 1
            image: rhel-7.6-server-x86_64-latest
            networks:
              - provider_net_quicklab
            userdata: |
              #cloud-config
              chpasswd:
                list: |
                  root:{{ redhat }}
                expire: False
              packages:
                - git
                - python27-python-pip
                - make
                - rpmbuild
            availability_zone: nova
        credentials:
          filename: playbooks/clouds.yaml
          profile: openstack
  layout:
    inventory_layout:
      vars:
        hostname: __IP__
      hosts:
        RHEL7:
          count: 1
          host_groups:
          - RHEL7
samvarankashyap commented 5 years ago

@maveric-tellrv We are unable to reproduce the bug on both ansible version 2.8.4 and 2.8.5 Could you try downgrading to ansible 2.8.4 and try again and see if its the problem. It seems like YAML file is unable to load. It might because of some invalid character inside Pinfile.

I think it is due to the following the line

                  root:{{ redhat }}

could you try replacing it?

maveric-tellrv commented 5 years ago

The issue was due some invalid entry in ~/.config/linchpin/rundb-238368719696044.json. After deleting this file and retrying the linchpin up commands it worked successfully with the same PinFile. I am not sure what made the invalid entry in the rundb*.json file.

samvarankashyap commented 5 years ago

@maveric-tellrv I think rundb file has been corrupted. Please do re-open if it occurs again. Thank you for reporting