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

cfbs add InvalidModule should not traceback

    XMLWordPrintable

    Details

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

      Description

      When trying to add a module with cfbs from the index I should get a nice human readable error message instead of a traceback when there is no module to add.

      [root@hub cfbs]# cfbs add bollocks
      Traceback (most recent call last):
        File "/usr/local/bin/cfbs", line 8, in <module>
          sys.exit(main())
        File "/usr/local/lib/python3.6/site-packages/cfbs/main.py", line 145, in main
          non_interactive=args.non_interactive,
        File "/usr/local/lib/python3.6/site-packages/cfbs/commands.py", line 221, in add_command
          r = config.add_command(to_add, added_by, index_path, checksum, non_interactive)
        File "/usr/local/lib/python3.6/site-packages/cfbs/core.py", line 497, in add_command
          return self._add_modules(to_add, added_by, checksum, non_interactive)
        File "/usr/local/lib/python3.6/site-packages/cfbs/core.py", line 446, in _add_modules
          names = index.translate_aliases(names)
        File "/usr/local/lib/python3.6/site-packages/cfbs/core.py", line 140, in translate_aliases
          data = self[module]
        File "/usr/local/lib/python3.6/site-packages/cfbs/core.py", line 97, in __getitem__
          return self.data["index"][key]
      KeyError: 'bollocks'
      [root@hub cfbs]# cfbs --version
      cfbs 1.3.0
      

        Attachments

          Activity

            People

            Assignee:
            olehermanse Ole Herman Schumacher Elgesem
            Reporter:
            a10042 Nick Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: