Skip to content

feat(cli): Use SourceClient and DestinationClient directly#2165

Merged
yevgenypats merged 4 commits intomainfrom
feat/remove_plugin_manager
Sep 30, 2022
Merged

feat(cli): Use SourceClient and DestinationClient directly#2165
yevgenypats merged 4 commits intomainfrom
feat/remove_plugin_manager

Conversation

@yevgenypats
Copy link
Copy Markdown
Contributor

PluginManager abstraction is not needed anymore. makes less prop drilling and less code. see cloudquery/plugin-sdk#208

PluginManager abstraction is not needed anymore. makes less prop
drilling and less code. see cloudquery/plugin-sdk#208
@cq-bot cq-bot added the cli label Sep 30, 2022
@yevgenypats yevgenypats changed the title feat: Use SourceClient and DestinationClient directly feat(cli): Use SourceClient and DestinationClient directly Sep 30, 2022
@yevgenypats
Copy link
Copy Markdown
Contributor Author

The versions should go prob also to the SDK but we can do that later if needed. The most important thing was to get rid off the heavy pluginmanager abstraction anyway.

cli/cmd/sync.go Outdated
destPlugin.Close()
for _, destClient := range destClients {
if destClient != nil {
destClient.Close()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to the work in this PR, but technically this Close returns an error that we're ignoring, we may want to at least log it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Print is good - log is already done on the sdk side (though I should add some more there)

Comment on lines -167 to -170
totalResources, failedWrites, sourcePlugin.Errors(), sourcePlugin.Warnings())
if sourcePlugin.Errors() > 0 || sourcePlugin.Warnings() > 0 || failedWrites > 0 {
fmt.Println("Please check the logs for more details on errors/warnings.")
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these messages being removed, were they moved elsewhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to open a follow-up PR but I want us to stop parsing logs and the plugins return number of error and or warnings as they have this information anyway, this will make also consistent experience between debug and release (which I know was quite weird before)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, yeah that would be great

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep these lines in there for now though, we can remove them in the follow-up?

cli/cmd/sync.go Outdated
}
defer sourcePlugin.Close()
sourceClient := sourcePlugin.GetClient()
defer sourceClient.Close()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this also ignores any error we may get from Close

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@hermanschaaf
Copy link
Copy Markdown
Contributor

Much simpler 👍 I left a few comments unrelated to this PR really, so feel free to ignore, but we should probably address the error handling there at some point. The only real question for me is around the print lines being removed

yevgenypats and others added 2 commits September 30, 2022 18:15
Co-authored-by: Herman Schaaf <hermanschaaf@gmail.com>
@yevgenypats yevgenypats merged commit e594e61 into main Sep 30, 2022
@yevgenypats yevgenypats deleted the feat/remove_plugin_manager branch September 30, 2022 15:39
yevgenypats pushed a commit that referenced this pull request Sep 30, 2022
🤖 I have created a release *beep* *boop*
---


##
[1.3.0-pre.1](cli-v1.2.1-pre.1...cli-v1.3.0-pre.1)
(2022-09-30)


### Features

* **cli:** Use SourceClient and DestinationClient directly
([#2165](#2165))
([e594e61](e594e61))


### Bug Fixes

* ProgressBar output fix
([#2163](#2163))
([85fbd58](85fbd58))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants