Simplify conductor methods logic

Registered by Denis M. on 2014-01-10

    Method takes to much parameters which are examined on non-equality -
def update_backup(self, context, instance_id, backup_id,
                      **backup_fields):

        #some logic skipped

        if backup_id != backup.id:
            LOG.error("Backup IDs mismatch! Expected %s, found %s" %
                      (backup_id, backup.id))
            return
        if instance_id != backup.instance_id:
            LOG.error("Backup instance IDs mismatch! Expected %s, found %s" %
                      (instance_id, backup.instance_id))
            return

The easiest way to do next:
def update_backup(self, context, backup_id,
                      **backup_fields):
       backup = bkup_models.DBBackup.find_by(id=backup_id)
       for k, v in backup_fields.items():
              if hasattr(backup, k):
                  LOG.debug("Backup %s: %s" % (k, v))
                  setattr(backup, k, v)
       backup.save()

Blueprint information

Status:
Complete
Approver:
None
Priority:
Not
Drafter:
None
Direction:
Needs approval
Assignee:
Denis M.
Definition:
Superseded
Series goal:
None
Implementation:
Informational Informational
Milestone target:
None
Completed by
Denis M. on 2014-02-28

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/simplify-conductor-logic,n,z

Addressed by: https://review.openstack.org/65960
    Simplify conductor methods logic

** WORK WAS ABANDONED.. WE WILL NOT DO THIS ** [hub_cap]

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.