Skip to content

Commit

Permalink
Merge branch '2018.3' into '2019.2'
Browse files Browse the repository at this point in the history
Conflicts:
  - salt/client/mixins.py
  - salt/crypt.py
  - salt/engines/http_logstash.py
  - salt/engines/logstash_engine.py
  - salt/modules/win_file.py
  - salt/states/file.py
  - salt/states/linux_acl.py
  - salt/states/test.py
  - salt/transport/ipc.py
  - salt/utils/cloud.py
  - salt/utils/napalm.py
  - salt/utils/schedule.py
  - tests/integration/client/test_kwarg.py
  - tests/integration/modules/test_state.py
  - tests/unit/states/test_file.py
  • Loading branch information
Ch3LL committed Apr 18, 2019
2 parents 83a2b43 + 6ebc663 commit f86c53d
Show file tree
Hide file tree
Showing 70 changed files with 1,219 additions and 948 deletions.
24 changes: 17 additions & 7 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
languages:
Ruby: false
JavaScript: false
Python: true
PHP: false
version: "2"

engines:
exclude_patterns:
- "*.js"
- "*.rb"
- "*.php"

plugins:
radon:
enabled: true
exclude_paths:
exclude_patterns:
- "templates/"
config:
threshold: "D"

checks:
argument-count:
enabled: false
file-lines:
enabled: false
similar-code:
config:
threshold: 40
7 changes: 1 addition & 6 deletions doc/ref/states/writing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,6 @@ A State Module must return a dict containing the following keys/values:
Prefer to keep line lengths short (use multiple lines as needed),
and end with punctuation (e.g. a period) to delimit multiple comments.

The return data can also, include the **pchanges** key, this stands for
`predictive changes`. The **pchanges** key informs the State system what
changes are predicted to occur.

.. note::

States should not return data which cannot be serialized such as frozensets.
Expand Down Expand Up @@ -448,7 +444,6 @@ Example state module
'changes': {},
'result': False,
'comment': '',
'pchanges': {},
}
# Start with basic error-checking. Do all the passed parameters make sense
Expand All @@ -469,7 +464,7 @@ Example state module
# in ``test=true`` mode.
if __opts__['test'] == True:
ret['comment'] = 'The state of "{0}" will be changed.'.format(name)
ret['pchanges'] = {
ret['changes'] = {
'old': current_state,
'new': 'Description, diff, whatever of the new state',
}
Expand Down
74 changes: 37 additions & 37 deletions salt/beacons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ def list_beacons(self,
beacons = self._get_beacons(include_pillar, include_opts)

# Fire the complete event back along with the list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': True, 'beacons': beacons},
tag='/salt/minion/minion_beacons_list_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': True, 'beacons': beacons},
tag='/salt/minion/minion_beacons_list_complete')

return True

Expand All @@ -247,9 +247,9 @@ def list_available_beacons(self):
for _beacon in self.beacons if '.beacon' in _beacon]

# Fire the complete event back along with the list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': True, 'beacons': _beacons},
tag='/salt/minion/minion_beacons_list_available_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': True, 'beacons': _beacons},
tag='/salt/minion/minion_beacons_list_available_complete')

return True

Expand All @@ -270,11 +270,11 @@ def validate_beacon(self, name, beacon_data):
valid = True

# Fire the complete event back along with the list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': True,
'vcomment': vcomment,
'valid': valid},
tag='/salt/minion/minion_beacon_validation_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': True,
'vcomment': vcomment,
'valid': valid},
tag='/salt/minion/minion_beacon_validation_complete')

return True

Expand All @@ -300,10 +300,10 @@ def add_beacon(self, name, beacon_data):
self.opts['beacons'].update(data)

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_add_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_add_complete')

return True

Expand All @@ -326,10 +326,10 @@ def modify_beacon(self, name, beacon_data):
self.opts['beacons'].update(data)

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_modify_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_modify_complete')
return True

def delete_beacon(self, name):
Expand All @@ -350,10 +350,10 @@ def delete_beacon(self, name):
complete = True

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_delete_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_delete_complete')

return True

Expand All @@ -365,9 +365,9 @@ def enable_beacons(self):
self.opts['beacons']['enabled'] = True

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': True, 'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacons_enabled_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': True, 'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacons_enabled_complete')

return True

Expand All @@ -379,9 +379,9 @@ def disable_beacons(self):
self.opts['beacons']['enabled'] = False

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': True, 'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacons_disabled_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': True, 'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacons_disabled_complete')

return True

Expand All @@ -400,10 +400,10 @@ def enable_beacon(self, name):
complete = True

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_enabled_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_enabled_complete')

return True

Expand All @@ -422,10 +422,10 @@ def disable_beacon(self, name):
complete = True

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_disabled_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_disabled_complete')

return True

Expand Down
Loading

0 comments on commit f86c53d

Please sign in to comment.