Skip to content

Commit

Permalink
[pfsense] handle "."s prefixing php() output
Browse files Browse the repository at this point in the history
triggered by the presense of /var/run/booting and issue a warning.

Fixes #118
  • Loading branch information
opoplawski committed Jan 31, 2025
1 parent eb570cf commit 763b21a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/booting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- pfsense - handle "."s prefixing php() output triggered by the presense of /var/run/booting and issue a warning (https://github.com/pfsensible/core/issues/118)
4 changes: 4 additions & 0 deletions plugins/module_utils/pfsense.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,10 @@ def php(self, command):
cmd += command
cmd += '\n?>\n'
(dummy, stdout, stderr) = self.module.run_command('/usr/local/bin/php', data=cmd)
# If /var/run/booting is in place, various requires will emit a "."
(stdout, nsubs) = re.subn(r'^\.+', '', stdout)
if nsubs > 0:
self.module.warn('/var/run/booting appears to be present, confirm successful boot and remove if appropriate.')
# TODO: check stderr for errors
return json.loads(stdout)

Expand Down

0 comments on commit 763b21a

Please sign in to comment.