Documentation
¶
Overview ¶
Package chameleond contains utilities for managing chameleond releases on btpeers devices.
Index ¶
- func AssertChameleondServiceIsRunning(ctx context.Context, sshRunner ssh.Runner) error
- func DownloadChameleondBundle(ctx context.Context, sshRunner ssh.Runner, cacheAccess CacheAccess, ...) (string, error)
- func FetchBtpeerChameleondReleaseConfig(ctx context.Context, sshRunner ssh.Runner, fetchTimeout time.Duration) (*labapi.BluetoothPeerChameleondConfig, error)
- func FetchInstalledChameleondBundleCommit(ctx context.Context, sshRunner ssh.Runner) (string, error)
- func InstallChameleondBundle(ctx context.Context, sshRunner ssh.Runner, pathToBundleOnHost string) error
- func MarshalBtpeerChameleondReleaseConfig(config *labapi.BluetoothPeerChameleondConfig) (string, error)
- func PrepareEmptyInstallDir(ctx context.Context, sshRunner ssh.Runner) error
- func RemoveInstallDir(ctx context.Context, sshRunner ssh.Runner) error
- func SelectChameleondBundleByChameleondCommit(config *labapi.BluetoothPeerChameleondConfig, chameleondCommit string) (*labapi.BluetoothPeerChameleondConfig_ChameleondBundle, error)
- func SelectChameleondBundleByCrosReleaseVersion(config *labapi.BluetoothPeerChameleondConfig, dutCrosReleaseVersion string) (*labapi.BluetoothPeerChameleondConfig_ChameleondBundle, error)
- func SelectChameleondBundleByNextCommit(config *labapi.BluetoothPeerChameleondConfig) (*labapi.BluetoothPeerChameleondConfig_ChameleondBundle, error)
- func SelectChameleondBundleForDut(ctx context.Context, config *labapi.BluetoothPeerChameleondConfig, ...) (*labapi.BluetoothPeerChameleondConfig_ChameleondBundle, error)
- type CacheAccess
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertChameleondServiceIsRunning ¶
AssertChameleondServiceIsRunning will check the status of the chameleond service on the host and return a non-nil error if it is not running.
Supports both the legacy init.d chameleond service installed by chameleond bundles and the newer systemd chameleond service present on custom images.
The status check timeout is set to 30s to account for a delay in sending the ssh command, but the status check normally takes less than a second. It is not expected to ever exceed this timeout.
func DownloadChameleondBundle ¶
func DownloadChameleondBundle(ctx context.Context, sshRunner ssh.Runner, cacheAccess CacheAccess, dutName string, bundleConfig *labapi.BluetoothPeerChameleondConfig_ChameleondBundle) (string, error)
DownloadChameleondBundle downloads the bundle archive for the bundleConfig to the btpeer from GCS via the cache server. Returns the path of the bundle on the btpeer.
func FetchBtpeerChameleondReleaseConfig ¶
func FetchBtpeerChameleondReleaseConfig(ctx context.Context, sshRunner ssh.Runner, fetchTimeout time.Duration) (*labapi.BluetoothPeerChameleondConfig, error)
FetchBtpeerChameleondReleaseConfig downloads the production BluetoothPeerChameleondConfig JSON file from GCS via its public URL through the host and returns its unmarshalled contents.
Note: We use the public URL here rather than the cache to ensure we always use the latest version of the config file from GCS.
func FetchInstalledChameleondBundleCommit ¶
func FetchInstalledChameleondBundleCommit(ctx context.Context, sshRunner ssh.Runner) (string, error)
FetchInstalledChameleondBundleCommit checks the chameleond commit log file host to identify the and return the chameleond commit of the chameleond bundle currently installed on the btpeer.
func InstallChameleondBundle ¶
func InstallChameleondBundle(ctx context.Context, sshRunner ssh.Runner, pathToBundleOnHost string) error
InstallChameleondBundle installs chameleond on the btpeer using the bundle archive at the provided path on the host.
func MarshalBtpeerChameleondReleaseConfig ¶
func MarshalBtpeerChameleondReleaseConfig(config *labapi.BluetoothPeerChameleondConfig) (string, error)
MarshalBtpeerChameleondReleaseConfig marshals the config into JSON using the same settings as btpeer_manager, which is what is used to create the config JSON that this would be parsed from, so that the look is consistent.
func PrepareEmptyInstallDir ¶
PrepareEmptyInstallDir prepares the temporary install directory on the host that is used for chameleond installation. Deletes and recreates the dir if it already exists on the host.
func RemoveInstallDir ¶
RemoveInstallDir deletes the temporary install directory on the host that is used for chameleond installation.
func SelectChameleondBundleByChameleondCommit ¶
func SelectChameleondBundleByChameleondCommit(config *labapi.BluetoothPeerChameleondConfig, chameleondCommit string) (*labapi.BluetoothPeerChameleondConfig_ChameleondBundle, error)
SelectChameleondBundleByChameleondCommit returns the bundle config from the chameleond config that has a matching chameleond commit. Returns a non-nil error if no matching bundle config is found.
func SelectChameleondBundleByCrosReleaseVersion ¶
func SelectChameleondBundleByCrosReleaseVersion(config *labapi.BluetoothPeerChameleondConfig, dutCrosReleaseVersion string) (*labapi.BluetoothPeerChameleondConfig_ChameleondBundle, error)
SelectChameleondBundleByCrosReleaseVersion returns the bundle config that has the latest MinDutReleaseVersion that is less than or equal to the provided dutCrosReleaseVersion among all bundles configured in the chameleond config, excluding the bundle configured as the next bundle.
func SelectChameleondBundleByNextCommit ¶
func SelectChameleondBundleByNextCommit(config *labapi.BluetoothPeerChameleondConfig) (*labapi.BluetoothPeerChameleondConfig_ChameleondBundle, error)
SelectChameleondBundleByNextCommit returns the bundle config that is specified as the next bundle by commit in the chameleond config. Returns a non-nil error if the chameleond config has no next bundle configured or if the chameleond commit it specifies does not match any configured bundles.
func SelectChameleondBundleForDut ¶
func SelectChameleondBundleForDut(ctx context.Context, config *labapi.BluetoothPeerChameleondConfig, dutHostname, dutCrosReleaseVersion string) (*labapi.BluetoothPeerChameleondConfig_ChameleondBundle, error)
SelectChameleondBundleForDut returns the bundle config that the btpeer should be using for chameleond based on the chameleond config, the dut's hostname, and the dut's ChromeOS release version.
If there is a next bundle configured, the dut's hostname is in the NextDutHosts, and the dut's ChromeOS release version is in the NextDutReleaseVersions, the next chameleond bundle is selected via SelectChameleondBundleByNextCommit. Otherwise, the bundle is selected via SelectChameleondBundleByCrosReleaseVersion.
Types ¶
type CacheAccess ¶
type CacheAccess interface { // GetCacheUrl provides URL to download requested path to file. // URL will use to download image to USB-drive and provisioning. GetCacheUrl(ctx context.Context, dutName, filePath string) (string, error) }
CacheAccess is a subset of tlw.Access that just has the ability to access the cache server.