Skip to content
Permalink
Browse files

Merge pull request #5306 from daviddavis/ostree-sync

Fixes #10056 - Adding ostree sync
  • Loading branch information...
daviddavis committed Jul 14, 2015
2 parents 5f7bb52 + e3a30b3 commit b9402386e8afa23df2d2832dd63e6c72b8c119dc
@@ -0,0 +1,78 @@
module Actions
module Pulp
module Repository
module Presenters
class OstreePresenter < AbstractSyncPresenter
def progress
return 0.01 unless task_progress_details

completion = 0.0
completion += 0.4 if content_completed?(details("import_create_repository"))
completion += 0.3 if content_completed?(details("import_pull"))
completion += 0.3 if content_completed?(details("import_add_unit"))
completion
end

private

def humanized_details
ret = []
ret << _("Cancelled") if cancelled?

if pending?
ret << case current_step["step_type"]
when "import_create_repository"
_("Creating local repository")
when "import_pull"
_("Pulling remote branches")
when "import_add_unit"
_("Adding content units")
end
end

if task_result
ret << _("Branches updated")
end

ret << sync_error if sync_error
ret.join("\n")
end

def details(step_type)
task_progress_details.find do |step|
step[:step_type] == step_type
end
end

def content_completed?(content_details)
content_details && content_details[:state] == 'FINISHED'
end

def task_progress
sync_task['progress_report']
end

def task_progress_details
task_progress && task_progress['ostree_web_importer']
end

def pending?
sync_task["state"] == 'running'
end

def current_step
task_progress_details.detect { |step| step["state"] == "IN_PROGRESS" }
end

def finished?
sync_task["state"] == 'finished'
end

def sync_error
task_result && task_result["error_message"]
end
end
end
end
end
end
@@ -51,6 +51,8 @@ def presenter
Presenters::IsoPresenter.new(self)
elsif repo.try(:docker?)
Presenters::DockerPresenter.new(self)
elsif repo.try(:ostree?)
Presenters::OstreePresenter.new(self)
end
end

0 comments on commit b940238

Please sign in to comment.
You can’t perform that action at this time.