From 6ca67c61cb777699dca72ba19cdb7007be55988f Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 15 Oct 2014 15:53:43 -0700 Subject: [PATCH] Starting to stub out some classes. --- v2/ansible/executor/HostLog.py | 23 +++++++++++++++ v2/ansible/executor/HostLogManager.py | 9 ++++++ v2/ansible/executor/HostPlaybookIterator.py | 32 +++++++++++++++++++++ v2/ansible/executor/PlaybookExecutor.py | 15 ++++++++++ v2/ansible/executor/TaskExecutor.py | 12 ++++++++ v2/ansible/executor/TaskQueueManager.py | 16 +++++++++++ 6 files changed, 107 insertions(+) create mode 100644 v2/ansible/executor/HostPlaybookIterator.py diff --git a/v2/ansible/executor/HostLog.py b/v2/ansible/executor/HostLog.py index 1f84012e014..21d3feb2bf5 100644 --- a/v2/ansible/executor/HostLog.py +++ b/v2/ansible/executor/HostLog.py @@ -14,3 +14,26 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . + +class HostLog(object): + + def __init__(self, host): + self.host = host + + def add_task_result(self, task_result): + pass + + def has_failures(self): + assert False + + def has_changes(self): + assert False + + def get_tasks(self, are_executed=None, are_changed=None, are_successful=None): + assert False + + def get_current_running_task(self) + # atomic decorator likely required? + assert False + + diff --git a/v2/ansible/executor/HostLogManager.py b/v2/ansible/executor/HostLogManager.py index 1f84012e014..81cf520cf11 100644 --- a/v2/ansible/executor/HostLogManager.py +++ b/v2/ansible/executor/HostLogManager.py @@ -14,3 +14,12 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . + +class HostLogManager(object): + + def __init__(self): + pass + + def get_log_for_host(self, host): + assert False + diff --git a/v2/ansible/executor/HostPlaybookIterator.py b/v2/ansible/executor/HostPlaybookIterator.py new file mode 100644 index 00000000000..5292b6c72bb --- /dev/null +++ b/v2/ansible/executor/HostPlaybookIterator.py @@ -0,0 +1,32 @@ +# (c) 2012-2014, Michael DeHaan +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +class HostPlaybookIterator(object): + + def __init__(self, host, playbook): + pass + + def get_next_task(self): + assert False + + def is_blocked(self): + # depending on strategy, either + # ‘linear’ -- all prev tasks must be completed for all hosts + # ‘free’ -- this host doesn’t have any more work to do + assert False + + diff --git a/v2/ansible/executor/PlaybookExecutor.py b/v2/ansible/executor/PlaybookExecutor.py index 1f84012e014..7a7ed3d2937 100644 --- a/v2/ansible/executor/PlaybookExecutor.py +++ b/v2/ansible/executor/PlaybookExecutor.py @@ -14,3 +14,18 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . + +class PlaybookExecutor(object): + + def __init__(self, list_of_plays=[]): + # self.tqm = TaskQueueManager(forks) + assert False + + def run(self): + # for play in list_of_plays: + # for block in play.blocks: + # # block must know it’s playbook class and context + # tqm.enqueue(block) + # tqm.go()... + assert False + diff --git a/v2/ansible/executor/TaskExecutor.py b/v2/ansible/executor/TaskExecutor.py index 1f84012e014..0591931372d 100644 --- a/v2/ansible/executor/TaskExecutor.py +++ b/v2/ansible/executor/TaskExecutor.py @@ -14,3 +14,15 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . + +class TaskExecutor(object): + + def __init__(self, task, host): + pass + + def run(self): + # returns TaskResult + pass + + + diff --git a/v2/ansible/executor/TaskQueueManager.py b/v2/ansible/executor/TaskQueueManager.py index 1f84012e014..1016f35104e 100644 --- a/v2/ansible/executor/TaskQueueManager.py +++ b/v2/ansible/executor/TaskQueueManager.py @@ -14,3 +14,19 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . + +class TaskQueueManagerHostPlaybookIterator(object): + + def __init__(self, host, playbook): + pass + + def get_next_task(self): + assert False + + def is_blocked(self): + # depending on strategy, either + # ‘linear’ -- all prev tasks must be completed for all hosts + # ‘free’ -- this host doesn’t have any more work to do + assert False + +