ZAPI-696: deprecate package_name and package_version fields in VMAPI objects

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2016-03-02T20:19:05.000Z)

Fix Versions

2016-03-03 Junior (Release Date: 2016-03-03)

Description

package_version and package_name should be deprecated. External systems wishing to know package details should use billing_id and lookup the package from PAPI. Duplicating the data in VMAPI makes things harder to keep up-to-date as ZAPI-693 points out. It doesn't make sense to have to update 3 fields instead of one to point to the package

Comments

Comment by Josh Wilsdon
Created at 2015-11-24T23:04:20.000Z
Updated at 2018-05-07T17:50:50.213Z
a patch for vmapi:

diff --git a/lib/apis/moray.js b/lib/apis/moray.js
index 8d713bb..747b699 100644
--- a/lib/apis/moray.js
+++ b/lib/apis/moray.js
@@ -50,6 +50,12 @@ var SEARCHABLE_FIELDS = [
     'create_timestamp'
 ];

+// Fields that are deprecated that we're going to remove from VMs as we put
+var DEPRECATED_VM_FIELDS = [
+    'package_name',
+    'package_version'
+];
+
 /*
  * Basically the VMs table
  */
@@ -907,6 +913,7 @@ Moray.prototype._deleteBucket = function (name, cb) {
  */
 Moray.prototype._toMorayVm = function (vm) {
     var copy = common.clone(vm);
+    var idx;

     var timestamps = ['create_timestamp', 'last_modified', 'destroyed' ];
     timestamps.forEach(function (key) {
@@ -920,6 +927,11 @@ Moray.prototype._toMorayVm = function (vm) {
         }
     });

+    // Remove deprecated fields
+    for (idx in DEPRECATED_VM_FIELDS) {
+        delete copy[DEPRECATED_VM_FIELDS[idx]];
+    }
+
     // Only stringify if they are object
     var fields = ['nics', 'datasets', 'snapshots', 'internal_metadata',
         'customer_metadata'];

Comment by Bot Bot [X]
Created at 2016-03-02T20:14:11.000Z

sdc-vmapi commit 2db750d (branch master, by Josh Wilsdon)

ZAPI-696 deprecate package_name and package_version fields in VMAPI objects
    Reviewed by: Trent Mick <trentm@gmail.com>