ch-remote: Simplify ch-remote create from config file

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2022-07-01 11:55:17 +01:00 committed by Sebastien Boeuf
parent 216f330f4e
commit 46bbe0e612

View File

@ -321,9 +321,8 @@ fn create_api_command(socket: &mut UnixStream, path: &str) -> Result<(), Error>
.read_to_string(&mut data)
.map_err(Error::ReadingStdin)?;
} else {
let mut f = std::fs::File::open(path).map_err(Error::ReadingFile)?;
f.read_to_string(&mut data).map_err(Error::ReadingFile)?;
};
data = std::fs::read_to_string(path).map_err(Error::ReadingFile)?;
}
simple_api_command(socket, "PUT", "create", Some(&data)).map_err(Error::ApiClient)
}