Skip to content

Commit

Permalink
remove class options as mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
kumar1202 committed Sep 15, 2024
1 parent 90e8221 commit 602184f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions lib/gojira/command/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ class Cluster < Gojira::Command::Base
REQUIRED_CLASS_OPTIONS = %i[tls_enabled]

desc "validate", "validates kong config for a cluster"
method_option :kong_state_file, aliases: '-s', type: :string, desc: 'Kong State File', required: true
method_option :env_name, aliases: '-n', type: :string, desc: 'Environment identifier name', required: true
method_option :compliance_type, aliases: '-c', type: :string, desc: 'Compliance Type', enum: ['pci', 'non-pci'], required: true
method_option :cluster_file, aliases: '-f', type: :string, desc: 'Cluster file path', required: true
method_option :dc_name, aliases: '-d', type: :string, desc: 'DC Name', required: true
method_option :kong_state_file, aliases: '-s', type: :string, desc: 'Kong State File', required: false
method_option :env_name, aliases: '-n', type: :string, desc: 'Environment identifier name', required: false
method_option :compliance_type, aliases: '-c', type: :string, desc: 'Compliance Type', enum: ['pci', 'non-pci'], required: false
method_option :cluster_file, aliases: '-f', type: :string, desc: 'Cluster file path', required: false
method_option :dc_name, aliases: '-d', type: :string, desc: 'DC Name', required: false
def validate
validate_options
deck = Gojira::Deck::Gateway.new('deck', get_control_plane)
Expand All @@ -23,11 +23,11 @@ def validate
end

desc "diff", "diff output for kong config in a cluster"
method_option :kong_state_file, aliases: '-s', type: :string, desc: 'Kong State File', required: true
method_option :env_name, aliases: '-n', type: :string, desc: 'Environment identifier name', required: true
method_option :compliance_type, aliases: '-c', type: :string, desc: 'Compliance Type', enum: ['pci', 'non-pci'], required: true
method_option :cluster_file, aliases: '-f', type: :string, desc: 'Cluster file path', required: true
method_option :dc_name, aliases: '-d', type: :string, desc: 'DC Name', required: true
method_option :kong_state_file, aliases: '-s', type: :string, desc: 'Kong State File', required: false
method_option :env_name, aliases: '-n', type: :string, desc: 'Environment identifier name', required: false
method_option :compliance_type, aliases: '-c', type: :string, desc: 'Compliance Type', enum: ['pci', 'non-pci'], required: false
method_option :cluster_file, aliases: '-f', type: :string, desc: 'Cluster file path', required: false
method_option :dc_name, aliases: '-d', type: :string, desc: 'DC Name', required: false
def diff
validate_options
deck = Gojira::Deck::Gateway.new('deck', get_control_plane)
Expand All @@ -38,11 +38,11 @@ def diff
end

desc "sync", "syncs kong config to a cluster"
method_option :kong_state_file, aliases: '-s', type: :string, desc: 'Kong State File', required: true
method_option :env_name, aliases: '-n', type: :string, desc: 'Environment identifier name', required: true
method_option :compliance_type, aliases: '-c', type: :string, desc: 'Compliance Type', enum: ['pci', 'non-pci'], required: true
method_option :cluster_file, aliases: '-f', type: :string, desc: 'Cluster file path', required: true
method_option :dc_name, aliases: '-d', type: :string, desc: 'DC Name', required: true
method_option :kong_state_file, aliases: '-s', type: :string, desc: 'Kong State File', required: false
method_option :env_name, aliases: '-n', type: :string, desc: 'Environment identifier name', required: false
method_option :compliance_type, aliases: '-c', type: :string, desc: 'Compliance Type', enum: ['pci', 'non-pci'], required: false
method_option :cluster_file, aliases: '-f', type: :string, desc: 'Cluster file path', required: false
method_option :dc_name, aliases: '-d', type: :string, desc: 'DC Name', required: false
def sync
require 'pry'; binding.pry
validate_options
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/gojira/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
expect_any_instance_of(Gojira::Command::Cluster).to receive(:sync)
cli.options = {kong_state_file: "state.yaml", env_name: "production", compliance_type: "pci", cluster_file: "clusters.yaml", dc_name: "nm"}
#require 'pry'; binding.pry
cli.invoke('cluster', ["sync --kong-state-file='anc.yaml'"], {kong_state_file: "state.yaml", env_name: "production", compliance_type: "pci", cluster_file: "clusters.yaml", dc_name: "nm"})
cli.invoke('cluster', ["sync"], {kong_state_file: "state.yaml", env_name: "production", compliance_type: "pci", cluster_file: "clusters.yaml", dc_name: "nm"})
end
end

Expand Down

0 comments on commit 602184f

Please sign in to comment.