-
Notifications
You must be signed in to change notification settings - Fork 0
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
Completed Source_PhysicalServer workflow #4
base: v1.1
Are you sure you want to change the base?
Conversation
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.
Minor nits, Go ahead, fix and merge
Type: schema.TypeBool, | ||
Optional: true, | ||
Default: true, | ||
Description: `Forcefully register physical server to target cluster`, |
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.
Double quotes .. consistent with below.
} | ||
|
||
func resourceCohesitySourcePhysicalServerCreate(resourceData *schema.ResourceData, configMetaData interface{}) error { | ||
log.Printf("[INFO] Starting PS Registration") |
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.
Replace PS with Physical Server.
|
||
if err != nil { | ||
log.Printf(err.Error()) | ||
return errors.New("Failed to register Cohesity protection source") |
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.
better to add the protection source type ? Physical Server
} | ||
|
||
func resourceCohesitySourcePhysicalServerRead(resourceData *schema.ResourceData, configMetaData interface{}) error { | ||
log.Printf("Starting Read") |
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.
Be consistent with logging [INFO] or [DEBUG]
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.
can you change the file name to use snake cases (change this physicalServer to physical_server). Didn't find the resource inclusion in the provider.go file, without this the resource wouldn't be included in the provider
return errors.New("Failed to authenticate with Cohesity") | ||
} | ||
|
||
protectionSourceID, _ := strconv.ParseInt(resourceData.Id(), 10, 64) |
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.
can you add a comment here to tell what strconv.ParseInt(resourceData.Id(), 10, 64) this is doing
if *protectionSource.ProtectionSource.Name == endpoint { | ||
log.Printf("[INFO] Found the Physical Server protection source %s on cohesity cluster", endpoint) | ||
//validate the Physical Server Source Registration | ||
if *protectionSource.LogicalSize == 0 { |
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.
why are you checking the logical size here, we can just check the name, if its there then return nil
|
||
// *protectionSource.RegistrationInfo.AccessInfo.Endpoint != endpoint { | ||
// return fmt.Errorf("Failed to valaidate created physical server source") | ||
// } |
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.
Can you pls remove all the commented code
No description provided.