Merge branch 'master' into f/centos8

Signed-off-by: ZhangXiao <xiao.zhang@windriver.com>
Change-Id: I26af55ba7b74ba91cf5c764ee5c26a65e08c870c
This commit is contained in:
ZhangXiao 2020-12-02 13:12:37 +08:00
commit 381791afcf
28 changed files with 94 additions and 67 deletions

View File

@ -41,10 +41,12 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
repository_name = 'openstack/stx-fault'
project = u'StarlingX Fault Management'
bug_project = 'starlingx'
bug_tag = 'stx.fault'
# openstackdocstheme options
openstackdocs_repo_name = 'starlingx/fault'
openstackdocs_use_storyboard = True
openstackdocs_auto_name = False
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
@ -55,7 +57,7 @@ add_module_names = False
show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = 'native'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass

View File

@ -1,8 +1,8 @@
sphinx>=1.6.2
openstackdocstheme>=1.26.0 # Apache-2.0
sphinx>=2.0.0,!=2.1.0 # BSD
openstackdocstheme>=2.2.1 # Apache-2.0
# Release Notes documentation
reno>=0.1.1 # Apache2
reno>=3.1.0 # Apache-2.0
# Api Ref documentation
os-api-ref>=1.4.0 # Apache-2.0

View File

@ -27,11 +27,6 @@ project = u'StarlingX Fault Management'
copyright = u'2018, StarlingX'
author = u'StarlingX'
# The short X.Y version
version = u''
# The full version, including alpha/beta/rc tags
release = u'0.1'
# -- General configuration ---------------------------------------------------
@ -58,8 +53,10 @@ source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
bug_project = '1027'
bug_tag = 'stx.bug'
# openstackdocstheme options
openstackdocs_repo_name = 'starlingx/fault'
openstackdocs_use_storyboard = True
openstackdocs_auto_name = False
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -74,7 +71,7 @@ language = None
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = 'native'
# -- Options for HTML output -------------------------------------------------

View File

@ -1,4 +1,4 @@
SRC_DIR="."
EXCLUDE_FILES_FROM_TAR="centos"
TIS_PATCH_VER=14
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -285,6 +285,9 @@ FM_ALARM_ID_PATCH_OBS_IN_SYSTEM = ALARM_GROUP_SW_MGMT + ".003"
FM_ALARM_ID_HOST_VERSION_MISMATCH = ALARM_GROUP_SW_MGMT + ".004"
FM_ALARM_ID_UPGRADE_IN_PROGRESS = ALARM_GROUP_SW_MGMT + ".005"
# Device image alarm id
FM_ALARM_ID_DEVICE_IMAGE_UPDATE_IN_PROGRESS = ALARM_GROUP_SW_MGMT + ".006"
# Security log id
FM_LOG_ID_INVALID_PASSWORD = ALARM_GROUP_SECURITY + ".001"
FM_LOG_ID_USER_LOCKOUT = ALARM_GROUP_SECURITY + ".002"

View File

@ -140,17 +140,17 @@ class FaultAPIsBase(object):
""" Validate the attributes
only applies to Telco specific attributes"""
if data.alarm_state not in constants.ALARM_STATE:
raise ClientException("Invalid Fault State: %s" %
data.alarm_state)
raise ClientException("Invalid Fault State: %s" %
data.alarm_state)
if data.severity not in constants.ALARM_SEVERITY:
raise ClientException("Invalid Fault Severity: %s" %
data.severity)
raise ClientException("Invalid Fault Severity: %s" %
data.severity)
if data.alarm_type not in constants.ALARM_TYPE:
raise ClientException("Invalid Fault Type: %s" %
data.alarm_type)
raise ClientException("Invalid Fault Type: %s" %
data.alarm_type)
if data.probable_cause not in constants.ALARM_PROBABLE_CAUSE:
raise ClientException("Invalid Fault Probable Cause: %s" %
data.probable_cause)
raise ClientException("Invalid Fault Probable Cause: %s" %
data.probable_cause)
@staticmethod
def alarm_allowed(alarm_severity, threshold):

View File

@ -1,2 +1,2 @@
SRC_DIR="sources"
TIS_PATCH_VER=9
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -78,8 +78,13 @@ void fm_get_config_paramters() {
}
if (key.compare(FM_SQL_CONNECTION) != 0) {
// Don't log sql_connection, as it has a password
FM_INFO_LOG("Config key (%s), value (%s)",
key.c_str(), value.c_str());
if (key.compare(FM_CONF_PASSWORD) == 0 || key.compare(FM_CONF_CONNECTION) == 0) {
// Don't log password values
continue;
} else {
FM_INFO_LOG("Config key (%s), value (%s)",
key.c_str(), value.c_str());
}
}
}
}

View File

@ -92,6 +92,8 @@
#define FM_REGION_NAME "region_name"
#define FM_DEBUG_FLAG "debug"
#define FM_STRING_TRUE "True"
#define FM_CONF_PASSWORD "password"
#define FM_CONF_CONNECTION "connection"
#define CLEAR_ALL_REASON_TEXT "System initiated hierarchical alarm clear"

View File

@ -1,2 +1,2 @@
SRC_DIR="fm_doc"
TIS_PATCH_VER=16
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -3052,6 +3052,21 @@
Management_Affecting_Severity: warning
Degrade_Affecting_Severity: none
900.006:
Type: Alarm
Description: Device image update operation in progress.
Entity_Instance_ID: host=controller
Severity: minor
Proposed_Repair_Action: Complete reboots of affected hosts.
Maintenance_Action:
Inhibit_Alarms:
Alarm_Type: environmental
Probable_Cause: unspecified-reason
Service_Affecting: False
Suppression: False
Management_Affecting_Severity: warning
Degrade_Affecting_Severity: none
900.101:
Type: Alarm
Description: Software patch auto-apply inprogress

View File

@ -1,2 +1,2 @@
SRC_DIR="sources"
TIS_PATCH_VER=6
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -1,2 +1,2 @@
SRC_DIR="fm"
TIS_PATCH_VER=3
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -21,6 +21,7 @@ BuildRequires: python3-oslo-middleware
Requires: python3-eventlet
Requires: python3-webob
Requires: python3-paste
Requires: setup
BuildRequires: systemd
@ -67,7 +68,7 @@ install -p -D -m 644 fm-api-pmond.conf %{buildroot}%{local_etc_pmond}/fm-api.con
# install default config files
cd %{_builddir}/%{name}-%{version} && oslo-config-generator --config-file fm/config-generator.conf --output-file %{_builddir}/%{name}-%{version}/fm.conf.sample
install -p -D -m 644 %{_builddir}/%{name}-%{version}/fm.conf.sample %{buildroot}%{_sysconfdir}/fm/fm.conf
install -p -D -m 600 %{_builddir}/%{name}-%{version}/fm.conf.sample %{buildroot}%{_sysconfdir}/fm/fm.conf
%clean
echo "CLEAN CALLED"
@ -88,7 +89,7 @@ rm -rf $RPM_BUILD_ROOT
%{pythonroot}/fm-%{version}*.egg-info
%config(noreplace) %{_sysconfdir}/fm/fm.conf
%config(noreplace) %attr(600,fm,fm)%{_sysconfdir}/fm/fm.conf
# systemctl service files
%{_unitdir}/fm-api.service

View File

@ -8,7 +8,7 @@
import sys
from oslo_config import cfg
cfg.CONF(sys.argv[1:], project='fm')
from fm.db import migration
from fm.db import migration # noqa: E402
CONF = cfg.CONF

View File

@ -10,7 +10,8 @@ setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps = -r{toxinidir}/test-requirements.txt
deps = -chttps://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt
-r{toxinidir}/test-requirements.txt
-e{[tox]stxdir}/config/tsconfig/tsconfig
-e{[tox]stxdir}/config/sysinv/cgts-client/cgts-client
-e{[tox]stxdir}/fault/fm-api

View File

@ -1,2 +1,2 @@
SRC_DIR="fmclient"
TIS_PATCH_VER=4
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -154,7 +154,7 @@ class HTTPClient(_BaseHTTPClient):
if kwargs.get('insecure', False) is True:
self.session.verify = False
else:
if kwargs.get('cacert', None) is not '':
if kwargs.get('cacert', None) is not '': # noqa: F632
self.session.verify = kwargs.get('cacert', True)
self.session.cert = (kwargs.get('cert_file'),

View File

@ -315,7 +315,7 @@ def main():
print('caught: %r, aborting' % (e), file=sys.stderr)
sys.exit(0)
except IOError as e:
except IOError:
sys.exit(0)
except Exception as e:

View File

@ -11,7 +11,7 @@ from fmclient.common import base
class EventLog(base.Resource):
def __repr__(self):
return "<EventLog %s>" % self._info
return "<EventLog %s>" % self._info
class EventLogManager(base.Manager):

View File

@ -79,8 +79,8 @@ def do_event_list(cc, args={}):
logs = cc.event_log.list(q=queryAsArray, limit=args.limit,
alarms=alarms, logs=logs,
include_suppress=include_suppress)
for l in logs:
utils.normalize_field_data(l, ['entity_instance_id', 'reason_text'])
for lg in logs:
utils.normalize_field_data(lg, ['entity_instance_id', 'reason_text'])
# omit action initially to keep output width sane
# (can switch over to vertical formatting when available from CLIFF)

View File

@ -12,7 +12,7 @@ from fmclient.common import base
class EventSuppression(base.Resource):
def __repr__(self):
return "<EventSuppression %s>" % self._info
return "<EventSuppression %s>" % self._info
class EventSuppressionManager(base.Manager):

View File

@ -82,24 +82,24 @@ def print_event_suppression_list(cc, no_paging, includeUUID):
def event_suppression_update(cc, data, suppress=False):
event_suppression_list = _event_suppression_list(cc, include_unsuppressed=True)
event_suppression_list = _event_suppression_list(cc, include_unsuppressed=True)
alarm_id_list = []
for alarm_id in data['alarm_id'].split(',') or []:
alarm_id_list.append(alarm_id)
alarm_id_list = []
for alarm_id in data['alarm_id'].split(',') or []:
alarm_id_list.append(alarm_id)
if suppress:
patch_value = 'suppressed'
else:
patch_value = 'unsuppressed'
if suppress:
patch_value = 'suppressed'
else:
patch_value = 'unsuppressed'
patch = []
for event_id in event_suppression_list:
if event_id.alarm_id in alarm_id_list:
print("Alarm ID: {} {}.".format(event_id.alarm_id, patch_value))
uuid = event_id.uuid
patch.append(dict(path='/' + 'suppression_status', value=patch_value, op='replace'))
cc.event_suppression.update(uuid, patch)
patch = []
for event_id in event_suppression_list:
if event_id.alarm_id in alarm_id_list:
print("Alarm ID: {} {}.".format(event_id.alarm_id, patch_value))
uuid = event_id.uuid
patch.append(dict(path='/' + 'suppression_status', value=patch_value, op='replace'))
cc.event_suppression.update(uuid, patch)
@utils.arg('--include-unsuppressed', action='store_true',

View File

@ -31,8 +31,10 @@ extensions = [
'reno.sphinxext',
]
bug_project = '1027'
bug_tag = 'stx.bug'
# openstackdocstheme options
openstackdocs_repo_name = 'starlingx/fault'
openstackdocs_use_storyboard = True
openstackdocs_auto_name = False
# Add any paths that contain templates here, relative to this directory.
# templates_path = ['_templates']
@ -83,7 +85,7 @@ exclude_patterns = []
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = 'native'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
@ -132,10 +134,6 @@ html_theme = 'starlingxdocs'
# directly to the root of the documentation.
# html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True

View File

@ -1,2 +1,2 @@
SRC_DIR="sources"
TIS_PATCH_VER=4
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -1,2 +1,2 @@
SRC_DIR="sources"
TIS_PATCH_VER=2
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -1,4 +1,4 @@
hacking!=0.13.0,<0.14,>=0.12.0
hacking
bashate >= 0.2
mock
PyYAML >= 3.1.0

View File

@ -88,11 +88,14 @@ commands =
# H405 multi line docstring summary not separated with an empty line
# H702 Argument to ... must be a string
# H903 Windows style line endings not allowed in code
# W504 line break after binary operator
# W605 invalid escape sequence
# E123, E125 skipped as they are invalid PEP-8.
# E501 skipped because some of the code files include templates
# that end up quite wide
show-source = True
ignore = H102,H104,H105,H301,H306,H401,H403,H404,H405,H702,H903,E123,E125,E501
ignore = H102,H104,H105,H301,H306,H401,H403,H404,H405,H702,H903,
W504,W605,E123,E125,E501
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
# TODO: H106 Dont put vim configuration in source files (off by default).
# H203 Use assertIs(Not)None to check for None (off by default).