cpe_remote_file: fail with clear message on invalid source url Summary: cpe_remote_file builds its source URL from gen_url (which can delegate to the cpe distro API). That lookup can return nil when the asset/handle cannot be resolved. A nil/invalid source makes the inner remote_file raise an opaque Chef::Exceptions::InvalidRemoteFileURI when the resource is BUILT (the source setter validates), which is before the resource’s own only_if guard can run – so the run crashes with a message that does not say why. This is the top remote_file exception family (InvalidRemoteFileURI, ~67 devices/day across cpe_waiter, cpe_fonts, cpe_wallpaper, cpe_nudge, cpe_uber_agent, cpe_gk, …). Validate the source URL with valid_url? BEFORE declaring the remote_file (so we pre-empt the opaque build-time exception) and fail with an explicit, actionable message instead. The message names the resource, file, target path, and root cause – distinguishing an unresolved url (gen_url/cpe distro returned nil) from an unreachable one (a HEAD request failed). Drops the now-redundant inner only_if. Per reviewer feedback (dtheyer): a resource that cannot converge system state to the specified intent should hard-fail rather than silently skip. This replaces the earlier skip-with-warn approach with a clear hard failure. Reviewed By: dtheyer Differential Revision: D109486793 fbshipit-source-id: 73f3c88d37f1f4d9e5f617d6be9582c0d671e7bf
cpe_remote_file: fail with clear message on invalid source url
Summary: cpe_remote_file builds its source URL from gen_url (which can delegate to the cpe distro API). That lookup can return nil when the asset/handle cannot be resolved. A nil/invalid source makes the inner remote_file raise an opaque Chef::Exceptions::InvalidRemoteFileURI when the resource is BUILT (the source setter validates), which is before the resource’s own only_if guard can run – so the run crashes with a message that does not say why.
source
This is the top remote_file exception family (InvalidRemoteFileURI, ~67 devices/day across cpe_waiter, cpe_fonts, cpe_wallpaper, cpe_nudge, cpe_uber_agent, cpe_gk, …).
Validate the source URL with valid_url? BEFORE declaring the remote_file (so we pre-empt the opaque build-time exception) and fail with an explicit, actionable message instead. The message names the resource, file, target path, and root cause – distinguishing an unresolved url (gen_url/cpe distro returned nil) from an unreachable one (a HEAD request failed). Drops the now-redundant inner only_if.
Per reviewer feedback (dtheyer): a resource that cannot converge system state to the specified intent should hard-fail rather than silently skip. This replaces the earlier skip-with-warn approach with a clear hard failure.
Reviewed By: dtheyer Differential Revision: D109486793 fbshipit-source-id: 73f3c88d37f1f4d9e5f617d6be9582c0d671e7bf
The CPE (“Client Platform Engineering”) repo contains a suite of Chef cookbooks used to manage Facebook’s client fleet.
We aim for compatibility with the latest public releases of the operating systems we manage.
Old IT-CPE tools are BSD-licensed with an additional patent grant; see LICENSE and PATENTS.
LICENSE
PATENTS
New Chef cookbooks in the itchef directory are under the Apache 2.0 license.
itchef
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
CPE tools
The CPE (“Client Platform Engineering”) repo contains a suite of Chef cookbooks used to manage Facebook’s client fleet.
We aim for compatibility with the latest public releases of the operating systems we manage.
Presentations
Join the CPE community
License
Old IT-CPE tools are BSD-licensed with an additional patent grant; see
LICENSEandPATENTS.New Chef cookbooks in the
itchefdirectory are under the Apache 2.0 license.