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

Linchpin validate fails on following Pinfile #778

Closed
samvarankashyap opened this issue Nov 5, 2018 · 5 comments
Closed

Linchpin validate fails on following Pinfile #778

samvarankashyap opened this issue Nov 5, 2018 · 5 comments
Assignees
Milestone

Comments

@samvarankashyap
Copy link
Contributor

samvarankashyap commented Nov 5, 2018

---
ember:
  topology:
    topology_name: ember
    resource_groups:
    - resource_group_name: libvirt-single
      resource_group_type: libvirt
      resource_definitions:
      - role: libvirt_node
        name: centos71
        uri: qemu:///system
        image_src: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1608.qcow2.xz
        count: 1
        networks:
          - name: default
  layout:
    inventory_layout:
      vars:
        hostname: __IP__
      hosts:
        example-node:
          count: 1
          host_groups:
            - example

Error:

(nummy) 🎩linchpin -vvv up
Processing target: ember
rundb_id: 2
uhash: e5816f
Topology 'OrderedDict([('topology_name', 'ember'), ('resource_groups', [OrderedDict([('resource_group_name', 'libvirt-single'), ('resource_group_type', 'libvirt'), ('resource_definitions', [OrderedDict([('role', 'libvirt_node'), ('name', 'centos71'), ('uri', 'qemu:///system'), ('image_src', 'http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1608.qcow2.xz'), ('networks', [OrderedDict([('name', 'default')])]), ('count', 1)])])])])])' does not validate.  For more information run `linchpin validate`
(nummy) 🎩linchpin validate
Traceback (most recent call last):
  File "/home/srallaba/.virtualenvs/nummy/bin/linchpin", line 11, in <module>
    load_entry_point('linchpin', 'console_scripts', 'linchpin')()
  File "/home/srallaba/.virtualenvs/nummy/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/srallaba/.virtualenvs/nummy/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/srallaba/.virtualenvs/nummy/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/srallaba/.virtualenvs/nummy/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/srallaba/.virtualenvs/nummy/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/srallaba/.virtualenvs/nummy/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/srallaba/.virtualenvs/nummy/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/srallaba/workspace/lp_ws/nummy/linchpin/linchpin/shell/__init__.py", line 613, in validate
    "validate\n{3}".format(kind, target, outcome)
IndexError: tuple index out of range
@samvarankashyap samvarankashyap changed the title Linchpin validate fails on following topology Linchpin validate fails on following Pinfile Nov 5, 2018
@samvarankashyap samvarankashyap added this to the v1.6.5 milestone Nov 5, 2018
@14rcole
Copy link
Contributor

14rcole commented Nov 6, 2018

@samvarankashyap did you fix this? I can't reproduce the error when I test against the most recent develop branch?

@samvarankashyap
Copy link
Contributor Author

@14rcole I think its not fixed . Let me check it again .

@samvarankashyap
Copy link
Contributor Author

samvarankashyap commented Nov 6, 2018

@14rcole

---
ember:
  topology:
  - topology_name: ember
    resource_groups:
    - resource_group_name: libvirt-single
      resource_group_type: libvirt
      resource_definitions:
      - role: libvirt_node
        name: centos71
        uri: qemu:///system
        image_src: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1608.qcow2.xz
        count: 1
        networks:
          - name: default
 
  layout:
    inventory_layout:
      vars:
        hostname: __IP__
      hosts:
        example-node:
          count: 1
          host_groups:
            - example

linchpin validate says:
(k8s) 🎩linchpin validate

[OrderedDict([('topology_name', 'ember'), ('resource_groups', [OrderedDict([('resource_group_name', 'libvirt-single'), ('resource_group_type', 'libvirt'), ('resource_definitions', [OrderedDict([('role', 'libvirt_node'), ('name', 'centos71'), ('uri', 'qemu:///system'), ('image_src', 'http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1608.qcow2.xz'), ('count', 1), ('networks', [OrderedDict([('name', 'default')])])])])])])])] not found in workspace

which should not !

@14rcole
Copy link
Contributor

14rcole commented Nov 6, 2018

@samvarankashyap so the reason that's happening there is that topology_name is under-indented. linchpin therefore sees topology: as a key that requires a value rather than a key with a child dict, and thinks that everything below is a file.

Unfortunately, linchpin only validates data inside of each resource_definition. We could expand validation or do some sort of multi-layer validation, but those are really our only options, and both will take a while to fix

@14rcole
Copy link
Contributor

14rcole commented Jan 8, 2019

Fixed by #892

@14rcole 14rcole closed this as completed Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants