akamai / cli-property-manager

Use this Property Manager CLI to automate Akamai property changes and deployments across many environments.
Apache License 2.0
29 stars 22 forks source link

DXE-1960 --srcver option doesn't work #81

Open naraumi opened 1 year ago

naraumi commented 1 year ago

After using the following command, the "based on" value in the Property Manager UI doesn't show "Version 1" but the latest version. akamai property-manager property-update -p <property> --srcprop <srcprop> --srcver 1

It seems --srcver option doesn't work.

Thank you in advance.

naraumi commented 1 year ago

I'm from Akatec. Please let me know if you have any questions.

wzagrajcz commented 1 year ago

Hello @naraumi Thank You for opening the issue. Can You confirm (or correct if any mistakes) steps to reproduce this issue?

  1. Have some property (let's call it prop_1) with at least two versions (1 and 2).
  2. You create a new property e.g. named prop_2: akamai property-manager property-update -p prop_2 --srcprop prop_1 --srcver 1 The property is created correctly but it looks (in UI) that property was created from version 2. Is that correct understanding?

Thanks and best regards, Wojciech

naraumi commented 1 year ago

Hi @wzagrajcz Thank you for checking my post.

The property is created correctly but it looks (in UI) that property was created from version 2. Is that correct understanding?

Yes, your understanding is correct. In my test, I created a new version of the property with --srcver 1 but UI shows it is based on Version 202 (the latest version). image

Regards, naraumi

wzagrajcz commented 1 year ago

Hello @naraumi Thanks for confirming that. After brief check it seems that indeed there is something wrong with this options. We will go back to You if we have any update.

best regards, Wojciech

wzagrajcz commented 1 year ago

Hello @naraumi After some deeper investigation, I conclude that cli-pm works as expected: it's copying correct rules from correct property version to correct property. At this moment API does not directly allow to clone versions of other properties but to clone the latest version of target property and put rules from source property into newly created one.

Maybe it will help you to understand it better, learning what happens under the hood (at this moment) when running: akamai property-manager property-update -p prop_2 --srcprop prop_1 --srcver 1 In this case, since user didn't specify --propver, cli would create new property version, by first cloning latest version of prop_2 and then updating its rules to the ones from prop_1 version 1. UI is showing the actual source of the property. So as we cloning the latest version of prop_2, then UI is showing that.

This works this way because, although PAPI allows creating new property version based on some version of the same property, it does not directly allow to clone versions of other properties. Therefore rules need to be copied "by hand" from one prop version to the other.

Thanks and best regards, Wojciech

TomHart commented 3 months ago

Hi, I'm noticing the same too:

  1. I have a property with versions, for example version 1 through 10
  2. I want to create a new version, based on the last deployed to "Production" version, let's say that's version 5
  3. So I try
    akamai pm property-update \
    --srcprop "example.com-UAT" \
    --srcver "5" \
    -p "example.com-UAT" \
    --message "Message test"

    In the UI this creates a new version based of version 10, not 5