Skip to content

Commit

Permalink
Rename _schedule.conf on YAML parse error (#58179)
Browse files Browse the repository at this point in the history
* delete_schedule_conf_on_yaml_parse_error

* delete_schedule_conf_on_yaml_parse_error

* delete_schedule_conf_on_yaml_parse_error

* doc

* changelog

* delete_schedule_conf_on_yaml_parse_error

* delete_schedule_conf_on_yaml_parse_error

* delete_schedule_conf_on_yaml_parse_error

* doc

* changelog

* Add some tests

* Rename instead of remove

* doc

* no sleep

* pylint

* Use direct import instead of __utils__

* Remove __utils__ from other modules __virtual__ func

* Remove py2 code

* Revert boto_ec2

There's a problem with the assign_funcs util that I don't know how to
fix

* Rever boto_sns

There a problems with the assign_funcs util that I don't know how to fix

* Remove py2 code form elbv2

* delete_schedule_conf_on_yaml_parse_error

* delete_schedule_conf_on_yaml_parse_error

* delete_schedule_conf_on_yaml_parse_error

* doc

* changelog

* Add some tests

* Rename instead of remove

* doc

* no sleep

* pylint

* Remove py2

* Fix format strings

* Fix some black

* fix some lint

* Fix failing test

* Added changelogs

* Moved test code of Twangboy, help of DmitryKuzmenko

* Redundant import

* Fix black

* Fix issue with iterator

Co-authored-by: twangboy <slee@saltstack.com>
  • Loading branch information
marbx and twangboy committed Sep 30, 2020
1 parent e931916 commit 1a37f5b
Show file tree
Hide file tree
Showing 7 changed files with 337 additions and 286 deletions.
2 changes: 2 additions & 0 deletions changelog/56216.fixed
@@ -0,0 +1,2 @@
An invalid _schedule.conf configuration file is renamed to _schedule.confYAMLError.
This avoids disabling the minion and busy polling the CPU on Windows.
2 changes: 2 additions & 0 deletions changelog/58177.fixed
@@ -0,0 +1,2 @@
An invalid _schedule.conf configuration file is renamed to _schedule.confYAMLError.
This avoids disabling the minion and busy polling the CPU on Windows.
404 changes: 203 additions & 201 deletions salt/config/__init__.py

Large diffs are not rendered by default.

14 changes: 5 additions & 9 deletions salt/modules/boto_elbv2.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Connection module for Amazon ALB
Expand Down Expand Up @@ -40,15 +39,12 @@
# keep lint from choking on _get_conn and _cache_id
# pylint: disable=E0602

from __future__ import absolute_import, print_function, unicode_literals

# Import Python libs
import logging

import salt.utils.versions

# Import Salt libs
from salt.ext import six
import salt.utils.boto3mod
import salt.utils.versions

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -76,7 +72,7 @@ def __virtual__():
"""
has_boto_reqs = salt.utils.versions.check_boto_reqs()
if has_boto_reqs is True:
__utils__["boto3.assign_funcs"](__name__, "elbv2")
salt.utils.boto3mod.assign_funcs(__name__, "elbv2")
return has_boto_reqs


Expand Down Expand Up @@ -296,7 +292,7 @@ def register_targets(name, targets, region=None, key=None, keyid=None, profile=N
salt myminion boto_elbv2.register_targets myelb "[instance_id,instance_id]"
"""
targetsdict = []
if isinstance(targets, six.string_types) or isinstance(targets, six.text_type):
if isinstance(targets, str):
targetsdict.append({"Id": targets})
else:
for target in targets:
Expand Down Expand Up @@ -333,7 +329,7 @@ def deregister_targets(name, targets, region=None, key=None, keyid=None, profile
salt myminion boto_elbv2.deregister_targets myelb "[instance_id,instance_id]"
"""
targetsdict = []
if isinstance(targets, six.string_types) or isinstance(targets, six.text_type):
if isinstance(targets, str):
targetsdict.append({"Id": targets})
else:
for target in targets:
Expand Down
9 changes: 3 additions & 6 deletions salt/modules/boto_ssm.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Connection module for Amazon SSM
Expand All @@ -14,13 +13,11 @@
:depends: boto3
"""
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals

import logging

import salt.utils.json as json

# Import Salt libs
import salt.utils.boto3mod
import salt.utils.json as json
import salt.utils.versions

log = logging.getLogger(__name__)
Expand All @@ -32,7 +29,7 @@ def __virtual__():
"""
has_boto_reqs = salt.utils.versions.check_boto_reqs()
if has_boto_reqs is True:
__utils__["boto3.assign_funcs"](__name__, "ssm")
salt.utils.boto3mod.assign_funcs(__name__, "ssm")
return has_boto_reqs


Expand Down

0 comments on commit 1a37f5b

Please sign in to comment.