ups: do not power on if power status is bad

This will be a configurable feature that people can bring in via an
optional package within the phosphor-state-manager recipe.

Tested:
- Set CurrentPowerStatus to Good and verified app returned 0 with
  success log
- Set CurrentPowerStatus to UninterruptiblePowerSupply and verified
  error was logged and non-zero rc was returned
- Built full flash image and verified expected behavior in simulation

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I0fd5dc43b4476fd99f07d79169a71d102bb065e8
diff --git a/service_files/phosphor-chassis-check-power-status@.service b/service_files/phosphor-chassis-check-power-status@.service
new file mode 100644
index 0000000..2c7812d
--- /dev/null
+++ b/service_files/phosphor-chassis-check-power-status@.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Check chassis power status
+Wants=obmc-power-start-pre@%i.target
+Before=obmc-power-start-pre@%i.target
+Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+After=op-reset-chassis-on@%i.service
+Conflicts=obmc-chassis-poweroff@%i.target
+ConditionPathExists=!/run/openbmc/chassis@%i-on
+
+[Service]
+Restart=no
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/phosphor-chassis-check-power-status --chassis %i
+
+[Install]
+RequiredBy=obmc-chassis-poweron@%i.target