Skip to content

Commit

Permalink
Don't try to set properties that are too long
Browse files Browse the repository at this point in the history
  • Loading branch information
patricoferris committed Jul 26, 2024
1 parent 9326ffc commit b71cce6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/zfs_store.ml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,17 @@ module Zfs = struct
Os.sudo ["zfs"; "create"; "--"; ds ]

let set t ds props =
let filtered_props =
List.filter_map (fun (k, v) ->
if String.length v > 1024 then begin
Logs.warn (fun f -> f "Property too long! (%s, %s)" k v);
None
end else Some (k ,v)) props
in
let set p v =
Os.sudo ["zfs"; "set"; "-u"; Fmt.str "%s=%s" p v; Dataset.full_name t ds ]
in
Lwt_list.iter_s (fun (p, v) -> set p v) props
Lwt_list.iter_s (fun (p, v) -> set p v) filtered_props

let get ds prop =
Os.pread ["zfs"; "get"; prop; ds; "-o"; "value" ] >|= fun s ->
Expand Down

0 comments on commit b71cce6

Please sign in to comment.