public async Task <ConfigDriveContent> GenerateConfigDriveContent(
            IDictionary <string, string> metadata, NetworkData?networkData, IEnumerable <UserData> userData,
            GenerateConfigDriveOptions options)
        {
            var result = new ConfigDriveContent("cidata");


            ValidateMetaData(metadata);
            result.Files.Add(new ResultFile("meta-data", await SerializeMetaData(metadata)));

            if (networkData != null)
            {
                ValidateNetworkData(networkData);
                result.Files.Add(new ResultFile("network-config", await _serializer.SerializeToYaml(networkData)));
            }

            var userDataArray = userData.ToArray();

            if (userDataArray.Length == 0)
            {
                return(result);
            }

            result.Files.Add(new ResultFile("user-data", await _userDataSerializer.SerializeUserData(userDataArray, options.UserData)));

            return(result);
        }
Exemplo n.º 2
0
 public Task <ConfigDriveContent> GenerateContent(GenerateConfigDriveOptions options)
 {
     return(_dataSource.GenerateConfigDriveContent(_metadata, _networkData, _userData, options));
 }