shakacode / control-plane-flow

The power of Kubernetes with the ease of Heroku! Our playbook for migrating from Heroku to Control Plane, controlplane.com, and our cpflow CLI source
Other
43 stars 2 forks source link

Unexpected behaviour of `cpflow generate` command #218

Closed zzaakiirr closed 2 months ago

zzaakiirr commented 3 months ago

Command

cpflow generate command's description states:

Description:
  Creates base Control Plane config and template files

  # Creates .controlplane directory with Control Plane config and other templates
  cpflow generate

Expected behaviuor

User expects that invoking this command will create .controlplane directory with basic config and templates

Actual behaviuor

Command fails with error:

ERROR: Can't find project config file at 'project_folder/.controlplane/controlplane.yml', please create it.
borela commented 3 months ago

@rafaelgomesxyz can we change the behavior of the command so that if the user doesn't provide the project config, it generates a default one?

rafaelgomesxyz commented 3 months ago

@borela This is definitely a bug, it should generate a config file by default. We even have a template for it: https://github.com/shakacode/control-plane-flow/blob/main/lib/generator_templates/controlplane.yml

rafaelgomesxyz commented 3 months ago

@zzaakiirr This is most likely because VALIDATIONS = [].freeze is missing from Command::Generate. I forgot to add it there when I added the doctor command.

zzaakiirr commented 3 months ago

@zzaakiirr This is most likely because VALIDATIONS = [].freeze is missing from Command::Generate. I forgot to add it there when I added the doctor command.

You are right, adding VALIDATIONS = [].freeze to Command::Generate fixed the issue - now expected directory and files are created

@rafaelgomesxyz Can I open PR for this or will you work on this? We need to fix test for this too (spec/command/generate_spec.rb:30)

rafaelgomesxyz commented 3 months ago

Feel free to open it.