Uploaded image for project: 'Magnolia CLI'
  1. Magnolia CLI
  2. NPMCLI-197

Add availability feature fails when an area is defined, but no components are included.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 3.0.4
    • None
    • Ubuntu 18.04.1 LTS
      node: v10.14.1

    Description

      Adding availability with the CLI fails if the page template definition has the area defined, but no components have been added to the availability yet. The feature can be used with the "add-availability" command or with the "create-component" command with the "-a" option.

      Add availability feature fails when the defintion looks like this:

      areas:
        main:

      Or like this: 

      areas:
        main:
          availableComponents:

       

      However the add availability feature works properly when the defintion has no area defined, or when it already has one or more components.

      Or like this: 

      areas:
        main:
          availableComponents:
            jumbo2:
              id: test1:components/jumbo2

       

      The purpose of this ticket is to ensure that the feature works in all of the scenarios listed above.

       

       

      Notes from original poster:

      I was following the tutorial while I got stuck at the "Create the quotation component" step

      https://documentation.magnolia-cms.com/display/DOCS60/Hello+Magnolia#HelloMagnolia-Createthequotationcomponent

      While executing this command "mgnl create-component quotation -a pages/hello@main"
      I got this error:

       

      tecla@tecla-vm:/opt/magnolia/light-modules/hello-magnolia$ mgnl create-component quotation -a pages/hello@main
      
      info Using configuration at /opt/node-v10.14.1-linux-x64/lib/node_modules/@magnolia/cli/lib/config/mgnl-cli.json
      info Using prototypes at /opt/node-v10.14.1-linux-x64/lib/node_modules/@magnolia/cli/lib/config/mgnl-cli-prototypes
      info No path option provided, component will be created relative to the current folder.
      ERR! hostNode.value.push is not a function
      ERR! TypeError: hostNode.value.push is not a function
      ERR!     at injectYamlData (/opt/node-v10.14.1-linux-x64/lib/node_modules/@magnolia/cli/lib/yamlHelper.js:119:20)
      ERR!     at Object.injectSnippetAt (/opt/node-v10.14.1-linux-x64/lib/node_modules/@magnolia/cli/lib/yamlHelper.js:86:7)
      ERR!     at injectComponentAvailability (/opt/node-v10.14.1-linux-x64/lib/node_modules/@magnolia/cli/lib/addAvailability.js:110:16)
      ERR!     at modifyYamlConfiguration (/opt/node-v10.14.1-linux-x64/lib/node_modules/@magnolia/cli/lib/addAvailability.js:94:24)
      ERR!     at fs.readFile (/opt/node-v10.14.1-linux-x64/lib/node_modules/@magnolia/cli/lib/addAvailability.js:78:5)
      ERR!     at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
      ERR! 
      ERR! 
      ERR! mgnl: 3.0.4 node: v10.14.1 os: linux
      ERR! please open an issue including this log on https://jira.magnolia-cms.com/browse/NPMCLI
      
      

       

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                nchieffo Nicolò Chieffo
                Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:

                  Checklists

                    Bug DoR
                    Task DoD