Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Offline flag for v0.12 #73

Merged
merged 4 commits into from
Sep 16, 2019

Conversation

yukinying
Copy link
Contributor

This is based from #72 to add --offline flag. It also makes unit test possible without connecting to GCP API.

This pull request would invalidate #38 as #38 has no version switch logic.

Copy link
Member

@briantkennedy briantkennedy left a comment

Choose a reason for hiding this comment

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

The logic in the change looks reasonable. One concern I have is that we have members which may not be populated if the value of another member meets a specific condition (eg, if offline is true, resourceManager is nil). I'd feel a bit more comfortable for the long run if the offline vs online behavior was abstracted behind an interface that has an offline and online implementation.

if err := cfg.LoadAndValidate(); err != nil {
return nil, errors.Wrap(err, "configuring")
if !offline {
if err := cfg.LoadAndValidate(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to skip the loading step entirely in offline mode?

@@ -122,6 +124,7 @@ type Converter struct {

cfg *converter.Config

// Talk to GCP resource manager. This field would be nil in offline mode.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should make Converter into an interface and add offline and online implementations.

@morgante
Copy link
Contributor

Overall looks fine, but I concur with @briantkennedy that we should change Converter to an interface with offline/online implementations.

@yukinying
Copy link
Contributor Author

I'd prefer doing that on a separate pull request (with an issue tracker). How does that sound?

@morgante
Copy link
Contributor

Ok, opened #75 to track.

@morgante morgante merged commit ba8e5af into GoogleCloudPlatform:master Sep 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants