Coverage for watcher/conf/service.py: 100%

8 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 b<>com 

3# 

4# Authors: Vincent FRANCOISE <vincent.francoise@b-com.com> 

5# 

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

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

8# You may obtain a copy of the License at 

9# 

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

11# 

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

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

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

15# implied. 

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

17# limitations under the License. 

18 

19import socket 

20 

21from oslo_config import cfg 

22 

23from watcher._i18n import _ 

24 

25SERVICE_OPTS = [ 

26 cfg.IntOpt('periodic_interval', 

27 default=60, 

28 mutable=True, 

29 help=_('Seconds between running periodic tasks.')), 

30 cfg.HostAddressOpt('host', 

31 default=socket.gethostname(), 

32 help=_('Name of this node. This can be an opaque ' 

33 'identifier. It is not necessarily a hostname, ' 

34 'FQDN, or IP address. However, the node name ' 

35 'must be valid within an AMQP key.') 

36 ), 

37 cfg.IntOpt('service_down_time', 

38 default=90, 

39 help=_('Maximum time since last check-in for up service.')) 

40] 

41 

42 

43def register_opts(conf): 

44 conf.register_opts(SERVICE_OPTS) 

45 

46 

47def list_opts(): 

48 return [ 

49 ('DEFAULT', SERVICE_OPTS), 

50 ]