Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3830

Traceback on missing build key

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Higher
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: N/A
    • Component/s: cfbs
    • Labels:
      None

      Description

      cfbs should give me a nice error message and tell me what to do instead of a traceback.

      https://github.com/nickanderson/cfengine-demo-select-business-unit-if-unassigned/commit/bb450b1f22bf5b80c8b1d106f10c04f88d695053#diff-26d322f2908501588148facf9400ffc4cb2dd053928300b6a608f24b9e9535e6

      ❯ cfbs add https://github.com/nickanderson/cfengine-demo-select-business-unit-if-unassigned
      Found 1 modules in 'https://github.com/nickanderson/cfengine-demo-select-business-unit-if-unassigned':
        - demo-select-business-unit-if-unassigned
      Do you want to add all 1 of them? [y/N] y
      Traceback (most recent call last):
        File "/home/nickanderson/.local/bin/cfbs", line 8, in <module>
          sys.exit(main())
        File "/home/nickanderson/.local/lib/python3.9/site-packages/cfbs/main.py", line 132, in main
          return commands.add_command(
        File "/home/nickanderson/.local/lib/python3.9/site-packages/cfbs/commands.py", line 550, in add_command
          return _add_using_url(
        File "/home/nickanderson/.local/lib/python3.9/site-packages/cfbs/commands.py", line 532, in _add_using_url
          config.add(module, remote_config)
        File "/home/nickanderson/.local/lib/python3.9/site-packages/cfbs/index.py", line 232, in add
          if self._module_is_in_build(module):
        File "/home/nickanderson/.local/lib/python3.9/site-packages/cfbs/index.py", line 222, in _module_is_in_build
          return module["name"] in (m["name"] for m in self["build"])
        File "/home/nickanderson/.local/lib/python3.9/site-packages/cfbs/index.py", line 193, in __getitem__
          return self._data[key]
      KeyError: 'build'
      ❯ cfbs --version
      cfbs 0.14.0
      ❯ curl -s https://raw.githubusercontent.com/nickanderson/cfengine-demo-select-business-unit-if-unassigned/main/cfbs.json
      {
        "name": "Demo select business unit if unassigned",
        "description": "Automatically select a business unit if one is not defined.",
        "type": "module",
        "provides": {
          "demo-select-business-unit-if-unassigned": {
            "description": "Automatically select a business unit if one is not defined.",
            "tags": ["demo"],
            "repo": "https://github.com/nickanderson/cfengine-demo-select-business-unit-if-unassigned",
            "steps": [
              "copy policy/main.cf services/demo-select-business-unit-if-unassigned/main.cf",
              "json cfbs/def.json def.json"
            ]
          }
        }
      }
      
      

        Attachments

          Activity

            People

            Assignee:
            craig.comstock Craig Comstock
            Reporter:
            a10042 Nick Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: