-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change return value and type for UpdateTXTRecord. Fixes #113 #114
Closed
gfenn-newbury
wants to merge
1
commit into
infobloxopen:master
from
gfenn-newbury:feature/fix-txt-record-update
+9
−10
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ type IBObjectManager interface { | |
CreateNetworkView(name string) (*NetworkView, error) | ||
CreatePTRRecord(netview string, dnsview string, recordname string, cidr string, ipAddr string, ea EA) (*RecordPTR, error) | ||
DeleteARecord(ref string) (string, error) | ||
DeleteZoneAuth(ref string) (string, error) | ||
DeleteZoneAuth(ref string) (string, error) | ||
DeleteCNAMERecord(ref string) (string, error) | ||
DeleteFixedAddress(ref string) (string, error) | ||
DeleteHostRecord(ref string) (string, error) | ||
|
@@ -615,28 +615,28 @@ func (objMgr *ObjectManager) GetTXTRecord(name string) (*RecordTXT, error) { | |
return &res[0], nil | ||
} | ||
|
||
func (objMgr *ObjectManager) UpdateTXTRecord(recordname string, text string) (*RecordTXT, error) { | ||
func (objMgr *ObjectManager) UpdateTXTRecord(recordname string, text string) (string, error) { | ||
var res []RecordTXT | ||
|
||
recordTXT := NewRecordTXT(RecordTXT{Name: recordname}) | ||
|
||
err := objMgr.connector.GetObject(recordTXT, "", &res) | ||
|
||
if len(res) == 0 { | ||
return nil, nil | ||
return "", nil | ||
} | ||
|
||
res[0].Text = text | ||
|
||
res[0].Zone = "" // set the Zone value to "" as its a non writable field | ||
|
||
_, err = objMgr.connector.UpdateObject(&res[0], res[0].Ref) | ||
ref, err := objMgr.connector.UpdateObject(&res[0], res[0].Ref) | ||
|
||
if err != nil || res == nil || len(res) == 0 { | ||
return nil, err | ||
return "", err | ||
} | ||
|
||
return &res[0], nil | ||
return ref, nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest returning of pointer to the object by updating the reference of the object beforehand. |
||
} | ||
|
||
func (objMgr *ObjectManager) DeleteTXTRecord(ref string) (string, error) { | ||
|
@@ -761,16 +761,15 @@ func (objMgr *ObjectManager) CreateZoneAuth(fqdn string, ea EA) (*ZoneAuth, erro | |
eas := objMgr.extendEA(ea) | ||
|
||
zoneAuth := NewZoneAuth(ZoneAuth{ | ||
Fqdn: fqdn, | ||
Ea: eas}) | ||
|
||
Fqdn: fqdn, | ||
Ea: eas}) | ||
|
||
ref, err := objMgr.connector.CreateObject(zoneAuth) | ||
zoneAuth.Ref = ref | ||
return zoneAuth, err | ||
} | ||
|
||
// Retreive a authortative zone by ref | ||
// Retreive a authortative zone by ref | ||
func (objMgr *ObjectManager) GetZoneAuthByRef(ref string) (ZoneAuth, error) { | ||
var res ZoneAuth | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reference of the object can be updated after this line.
res[0].Ref=ref