Coverage for watcher/decision_engine/scope/base.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-17 12:22 +0000

1# -*- encoding: utf-8 -*- 

2# Copyright (c) 2016 Servionica 

3# 

4# Licensed under the Apache License, Version 2.0 (the "License"); 

5# you may not use this file except in compliance with the License. 

6# You may obtain a copy of the License at 

7# 

8# http://www.apache.org/licenses/LICENSE-2.0 

9# 

10# Unless required by applicable law or agreed to in writing, software 

11# distributed under the License is distributed on an "AS IS" BASIS, 

12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 

13# implied. 

14# See the License for the specific language governing permissions and 

15# limitations under the License. 

16# 

17 

18import abc 

19 

20from watcher.common import context 

21 

22 

23class BaseScope(object, metaclass=abc.ABCMeta): 

24 """A base class for Scope mechanism 

25 

26 Child of this class is called when audit launches strategy. This strategy 

27 requires Cluster Data Model which can be segregated to achieve audit scope. 

28 """ 

29 

30 def __init__(self, scope, config): 

31 self.ctx = context.make_context() 

32 self.scope = scope 

33 self.config = config 

34 

35 @abc.abstractmethod 

36 def get_scoped_model(self, cluster_model): 

37 """Leave only nodes and instances proposed in the audit scope"""