lib/chronicle/etl/cli/jobs.rb in chronicle-etl-0.5.3 vs lib/chronicle/etl/cli/jobs.rb in chronicle-etl-0.5.4
- old
+ new
@@ -50,10 +50,12 @@
m = Chronicle::ETL::CLI::Main.new
m.help
cli_exit
end
+ cli_fail(message: "Job '#{name}' does not exist") if name && !Chronicle::ETL::Config.exists?("jobs", name)
+
job_definition = build_job_definition(name, options)
if job_definition.plugins_missing?
missing_plugins = job_definition.errors[:plugins]
.select { |error| error.is_a?(Chronicle::ETL::PluginNotInstalledError) }
@@ -100,10 +102,12 @@
end
desc "show", "Show details about a job"
# Show an ETL job
def show(name = nil)
+ cli_fail(message: "Job '#{name}' does not exist") if name && !Chronicle::ETL::Config.exists?("jobs", name)
+
job_definition = build_job_definition(name, options)
job_definition.validate!
puts Chronicle::ETL::Job.new(job_definition)
rescue Chronicle::ETL::JobDefinitionError => e
cli_fail(message: "Job definition error", exception: e)
@@ -138,10 +142,9 @@
def run_job(job_definition)
# FIXME: have to validate here so next method can work. This is clumsy
job_definition.validate!
# FIXME: clumsy to make CLI responsible for setting secrets here. Think about a better way to do this
job_definition.apply_default_secrets
-
job = Chronicle::ETL::Job.new(job_definition)
runner = Chronicle::ETL::Runner.new(job)
runner.run!
rescue RunnerError => e
cli_fail(message: "#{e.message}", exception: e)