Skip to content

Commit

Permalink
Merge pull request #418 from tcmitchell/tkt414-slicedefaults
Browse files Browse the repository at this point in the history
Set default values in SA create
  • Loading branch information
tcmitchell committed Sep 2, 2015
2 parents 81960d3 + dd7e11d commit 39dc0e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Migrate management scripts from geni-portal to geni-ch (#101)
* Return dates as strings from SA create (#397)
* Raise not implemented error for delete slice and delete project (#398)
* Set default values for slice and project creation (#414)

== 2.3 ==
* Add geni-revoke-member-certificate man page
Expand Down
10 changes: 10 additions & 0 deletions plugins/sarm/SAv1PersistentImplementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@ def create_slice(self, client_cert, credentials, options, session):

# fill in the fields of the object
slice = Slice()

# Set default values for fields that may not get set
setattr(slice, SA.slice_field_mapping['SLICE_DESCRIPTION'], '')
setattr(slice, SA.slice_field_mapping['SLICE_EXPIRED'], False)

project_urn = None
for key, value in options["fields"].iteritems():
if key == "SLICE_PROJECT_URN":
Expand Down Expand Up @@ -733,6 +738,11 @@ def create_project(self, client_cert, credentials, options, session):

# fill in the fields of the object
project = Project()

# Set default values for fields that may not get set
setattr(project, SA.project_field_mapping['PROJECT_DESCRIPTION'], '')
setattr(project, SA.project_field_mapping['PROJECT_EXPIRED'], False)

for key, value in options["fields"].iteritems():
setattr(project, SA.project_field_mapping[key], value)
project.creation = dt.datetime.utcnow()
Expand Down

0 comments on commit 39dc0e3

Please sign in to comment.