diff options
author | Lei YU <mine260309@gmail.com> | 2018-07-13 14:04:16 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2018-08-31 02:13:16 +0000 |
commit | e0e9aed2be16f2189759c36e63dbdef8819f12c9 (patch) | |
tree | afbde9c7fc824ab4e90fecd353e69ddfe3901f6b /xyz | |
parent | 5af83f1528f106c8f58966aee0a0a7b8eacd5dd7 (diff) | |
download | phosphor-dbus-interfaces-e0e9aed2be16f2189759c36e63dbdef8819f12c9.tar.gz phosphor-dbus-interfaces-e0e9aed2be16f2189759c36e63dbdef8819f12c9.zip |
EpocTime: Use proper errors on setting time failure
Depends on the time config setting, setting property of EpochTime
interface may fail, e.g. not allowed, or systemd prevents the time
setting.
It was using InsufficientPermission to indicate not allowed error, but
it is not ideal.
Use proper errors, e.g. NotAllowed for this interface, so it reports
error correctly.
Note that phosphor-logging now supports inherits of errors without meta.
So NotAllowed is defined in Common without meta, and inherited in
Time with extra meta.
Change-Id: I3e660905d6bcb94680303a030eb7b1402e2f0075
Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'xyz')
-rw-r--r-- | xyz/openbmc_project/Common.errors.yaml | 2 | ||||
-rw-r--r-- | xyz/openbmc_project/Common.metadata.yaml | 5 | ||||
-rw-r--r-- | xyz/openbmc_project/Time.errors.yaml | 4 | ||||
-rw-r--r-- | xyz/openbmc_project/Time.metadata.yaml | 14 | ||||
-rw-r--r-- | xyz/openbmc_project/Time/EpochTime.interface.yaml | 4 |
5 files changed, 27 insertions, 2 deletions
diff --git a/xyz/openbmc_project/Common.errors.yaml b/xyz/openbmc_project/Common.errors.yaml index f6b2734..fe0e531 100644 --- a/xyz/openbmc_project/Common.errors.yaml +++ b/xyz/openbmc_project/Common.errors.yaml @@ -6,3 +6,5 @@ description: Invalid argument was given. - name: InsufficientPermission description: Insufficient permission to perform operation +- name: NotAllowed + description: The operation is not allowed diff --git a/xyz/openbmc_project/Common.metadata.yaml b/xyz/openbmc_project/Common.metadata.yaml index e2b76cc..83a923c 100644 --- a/xyz/openbmc_project/Common.metadata.yaml +++ b/xyz/openbmc_project/Common.metadata.yaml @@ -12,3 +12,8 @@ level: ERR - name: InsufficientPermission level: INFO +- name: NotAllowed + level: INFO + meta: + - str: "REASON=%s" + type: string diff --git a/xyz/openbmc_project/Time.errors.yaml b/xyz/openbmc_project/Time.errors.yaml new file mode 100644 index 0000000..9bff979 --- /dev/null +++ b/xyz/openbmc_project/Time.errors.yaml @@ -0,0 +1,4 @@ +- name: NotAllowed + description: The operation is not allowed +- name: Failed + description: The operation failed diff --git a/xyz/openbmc_project/Time.metadata.yaml b/xyz/openbmc_project/Time.metadata.yaml new file mode 100644 index 0000000..cfef584 --- /dev/null +++ b/xyz/openbmc_project/Time.metadata.yaml @@ -0,0 +1,14 @@ +- name: NotAllowed + inherits: + - xyz.openbmc_project.Common.NotAllowed + meta: + - str: "OWNER=%s" + type: string + - str: "SYNC_METHOD=%s" + type: string +- name: Failed + inherits: + - xyz.openbmc_project.Common.InternalFailure + meta: + - str: "REASON=%s" + type: string diff --git a/xyz/openbmc_project/Time/EpochTime.interface.yaml b/xyz/openbmc_project/Time/EpochTime.interface.yaml index 7b49fc0..26f7b3a 100644 --- a/xyz/openbmc_project/Time/EpochTime.interface.yaml +++ b/xyz/openbmc_project/Time/EpochTime.interface.yaml @@ -12,7 +12,7 @@ properties: InsufficientPermission means it is not allowed to set time depend on the time settings. errors: - - xyz.openbmc_project.Common.Error.InternalFailure - - xyz.openbmc_project.Common.Error.InsufficientPermission + - xyz.openbmc_project.Time.Error.NotAllowed + - xyz.openbmc_project.Time.Error.Failed # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |