Move all these `if` blocks to an EL7-specific method.