Skip to content
Browse files

Merge branch 'htgoebel-fall-back-to-less'

  • Loading branch information...
drybjed committed Sep 8, 2019
2 parents 7a15ccf + 75b206a commit 6c8be4b13fe1ef71a7be5e6c2b6d2060bb93a3cf
Showing with 19 additions and 6 deletions.
  1. +4 −0 CHANGELOG.rst
  2. +15 −6 bin/debops-defaults
@@ -37,6 +37,10 @@ General
- The :command:`debops-init` script now also creates the .gitattributes file
for use with :command:`git-crypt`. It is commented out by default.

- The :command:`debops-defaults` command will check what pagers
(:command:`view`, :command:`less`, :command:`more`) are available and use the
best one automatically.

:ref:`debops.apt_install` role

@@ -96,13 +96,22 @@ def main(role_list):
config = read_config(project_root)
playbooks_path = find_playbookpath(config, project_root, required=True)

# Make sure required commands are present

if sys.stdout.isatty():
# Check if one of the output commands is present
sys.stdout = io.BytesIO() # suppress error message, if any
for cmd_args in (('view', '+set ft=yaml', '-'),
('less', '-'),
('more', '-')):
except SystemExit:
# this command was not found
cmd_args = None
sys.stdout = sys.__stdout__

if cmd_args and sys.stdout.isatty():
# if script is run as standalone, redirect to view
view = subprocess.Popen(['view', '+set ft=yaml', '-'],
view = subprocess.Popen(cmd_args, stdin=subprocess.PIPE)
aggregate_defaults(playbooks_path, role_list, view.stdin)
except IOError as e:

0 comments on commit 6c8be4b

Please sign in to comment.
You can’t perform that action at this time.