Uploaded image for project: 'Puppet Development Kit'
  1. Puppet Development Kit
  2. PDK-1272

`pdk convert` leaves invalid name field in metadata.json



    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDK 1.9.1
    • Component/s: None
    • Template:
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      If `pdk convert`ing a module with the old "user/module" style name in its metadata.json, the metadata.json is updated to change the name to "user-module" style.
    • QA Risk Assessment:
      Needs Assessment


      The Problem

      If you have a `/` in your name field instead of a `-` then you get an error when running `pdk test unit`.

      NoWay:npwalker-pe_code_manager_webhook nw$ pdk test unit
      pdk (INFO): Using Ruby 2.5.1
      pdk (INFO): Using Puppet 6.2.0
      [✖] Preparing to run the unit tests.
      [✔] Cleaning up after running unit tests.
      pdk (ERROR): The spec_prep rake task failed with the following error(s):
      Cloning into 'spec/fixtures/modules/pltraining-rbac'...
      Cloning into 'spec/fixtures/modules/stdlib'...
      Cloning into 'spec/fixtures/modules/abrader-gms'...
      I, [2019-02-01T11:09:29.882759 #36811]  INFO -- : Creating symlink from spec/fixtures/modules/npwalker/pe_code_manager_webhook to /Users/nw/git_repos/npwalker-pe_code_manager_webhook
      rake aborted!
      Errno::ENOENT: No such file or directory @ rb_file_s_symlink - (/Users/nw/git_repos/npwalker-pe_code_manager_webhook, spec/fixtures/modules/npwalker/pe_code_manager_webhook)
      Tasks: TOP => spec_prep
      (See full trace by running task with --trace)
      pdk (FATAL): Failed to prepare to run the unit tests.

      It seems like `pdk convert` should replace a forward slash with a hyphen to avoid the error but it does not.

      NoWay:tmp nw$ git clone https://github.com/npwalker/pe_code_manager_webhook/
      Cloning into 'pe_code_manager_webhook'...
      remote: Enumerating objects: 360, done.
      remote: Total 360 (delta 0), reused 0 (delta 0), pack-reused 360
      Receiving objects: 100% (360/360), 64.36 KiB | 693.00 KiB/s, done.
      Resolving deltas: 100% (156/156), done.
      NoWay:tmp nw$ cd pe_code_manager_webhook/
      NoWay:pe_code_manager_webhook nw$ git checkout 2.0.1
      Note: checking out '2.0.1'.
      You are in 'detached HEAD' state. You can look around, make experimental
      changes and commit them, and you can discard any commits you make in this
      state without impacting any branches by performing another checkout.
      If you want to create a new branch to retain commits you create, you may
      do so (now or later) by using -b with the checkout command again. Example:
        git checkout -b <new-branch-name>
      HEAD is now at 8d3003a Bump version to 2.0.1
      NoWay:pe_code_manager_webhook nw$ pdk convert
      ------------Files to be added-----------
      ----------Files to be modified----------
      You can find a report of differences in convert_report.txt.
      pdk (INFO): Module conversion is a potentially destructive action. Ensure that you have committed your module to a version control system or have a backup, and review the changes above before continuing.
      Do you want to continue and make these changes to your module? Yes
      [✔] Resolving default Gemfile dependencies.
      ------------Convert completed-----------
      13 files added, 2 files modified.
      NoWay:pe_code_manager_webhook nw$ pdk --version
      1.10.0.pre (heads/master-0-g553e6e0)
      NoWay:pe_code_manager_webhook nw$ cat metadata.json
        "name": "npwalker/pe_code_manager_webhook",




            tim.sharpe Tim Sharpe
            nick.walker Nick Walker
            0 Vote for this issue
            2 Start watching this issue



                Zendesk Support