Opened 12 years ago

Closed 11 years ago

#32 closed (fixed)

Parameters set in the __init__ method should be validated

Reported by: sedwards@bbn.com Owned by: somebody
Priority: major Milestone:
Component: Clients Version:
Keywords: v0.6.3 Cc:
Dependencies:

Description

The __init__() method for each object should call the setter functions and validdate the value before it gets set.

See for example, Organization's escalationContact.

Change History (8)

comment:1 Changed 12 years ago by sedwards@bbn.com

Milestone: 2012-09-04 client release

Started looking at this. PhysicalAddress?' fields aren't being checked.

Kevin says this will get checked as part of the reference objects by id discussion.

comment:2 Changed 12 years ago by sedwards@bbn.com

Keywords: v0.6.1 added
Milestone: 2012-09-04 client release

Kevin said that this is part of the ref-by-id fix. And it's currently possible to generate a PhysicalAddress object which can't be serialized to XML. So that's not good.

Bumping up to the list for the next release. If we can't do it we can bump it back down.

comment:3 Changed 12 years ago by sedwards@bbn.com

PhysicalAddress now works. I checked the various non-Object parameters to make sure they were being validated and they are fine.

Perhaps I should check the Object parameters as well....

comment:4 Changed 12 years ago by sedwards@bbn.com

Ok. I've found one small issue.

If I do:

        self.myResMap = ResourceMapping("myMapping",
                                        type="foo",
                                        sliver=self.mySliver,
                                        resource=self.myOrg)

(Notice self.myOrg is not a Resource.)

I get:

Traceback (most recent call last):
  File "gmoc_unittest.py", line 224, in setUp
    resource=self.myOrg)#, #self.myResource)
  File "/home/sedwards/monitoring2/monitoring/gmoc_client/gmoc.py", line 1247, in __init__
    self.sliver = sliver
  File "/home/sedwards/monitoring2/monitoring/gmoc_client/gmoc.py", line 1284, in sliver
    slivers = self._resource._slivers
AttributeError: 'Organization' object has no attribute '_slivers'

I think there is no validator on ResourceMapping's resource parameter.

comment:5 Changed 12 years ago by sedwards@bbn.com

Also I was able to set:

        self.myResource.interfaces.append( self.myResource )

I think the validator for the list of interfaces on a Resource object isn't working.

comment:6 Changed 12 years ago by sedwards@bbn.com

I was also able to set:

       self.mySA.users = [self.myOrg]

comment:7 Changed 12 years ago by sedwards@bbn.com

Keywords: v0.6.3 added; v0.6.1 removed
Milestone: 2012-09-04 client release

We've decided that fixing this is likely to introduce more problems than it fixes. Removing the label for the current release.

comment:8 Changed 11 years ago by chaos@bbn.com

Resolution: fixed
Status: newclosed

This is too generic (and we did a lot of work on this topic in January). I'm going to close it as fixed, and open tickets for individual instances of gmoc.py not validating __init__ parameters as we discover them.

Note: See TracTickets for help on using tickets.