This paste expires on 2162-06-06 00:38:07.898923. Repaste, or download this paste. . Pasted through web.

You are sparrow task check dsl expert -
use following links as documentation
https://github.com/melezhik/Sparrow6/blob/master/documentation/taskchecks.md
And generate task check dsl code to
verify output from df command and validate that you have swap and home mounts , and that /root partition  capacity is more then 20 percentage
# Sparrow6 Task Check: Disk & Mount Verification
# Input: Output from `df -h` or `df -k`
# Verifies: /home mount, / partition free space > 20%, swap presence
# ============================================================
# STEP 1: Verify /home mount exists
# ============================================================
within: ^/dev/.*\s+\d+\s+\d+\s+\d+\s+\d+%\s+/home\s*$
  note: /home mount found
end:
generator: <<CODE
!perl
my $home_found = scalar(@{matched()}) > 0 ? 1 : 0;
print "assert: $home_found /home mount is present\n";
CODE
# ============================================================
# STEP 2: Verify / (root) partition exists and check capacity
# ============================================================
# Capture: filesystem, total, used, avail, use%, mount
regexp: ^(/dev/\S+|\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)%\s+/\s*$
generator: <<CODE
!perl
my $caps = captures();
if (@$caps) {
    my $c = $caps->[0];  # [fs, total, used, avail, use_percent]
    my $use_pct = $c->[4];  # Use% as integer (e.g., 75 from "75%")
    
    # Check: available space > 20% means Use% < 80%
    my $avail_ok = ($use_pct < 80) ? 1 : 0;
    
    print "assert: $avail_ok root partition (/) available space > 20% (used: ${use_pct}%)\\n";
} else {
    print "assert: 0 root partition (/) not found in df output\\n";
}
CODE
# ============================================================
# STEP 3: Soft check for swap (df doesn't show swap by default)
# Note: For proper swap check, use: swapon --show or free -h
# This soft-check won't fail the overall test if swap isn't in df output
# ============================================================
~regexp: ^(/dev/\S+|\S+)\s+\d+\s+\d+\s+\d+\s+\d+%\s+(swap|/swap)\s*$
generator: <<CODE
!perl
if (matched()) {
    print "note: swap filesystem found in df output (unusual but valid)\\n";
    print "assert: 1 swap mount detected\\n";
} else {
    # Soft check: don't fail, just inform user
    print "note: swap not shown in df (expected - use 'swapon --show' for swap verification)\\n";
    print "assert: 1 swap check skipped - df doesn't report swap devices\\n";
}
CODE
# ============================================================
# STEP 4: Summary assertion (optional overall validation)
# ============================================================
generator: <<CODE
!perl
# Re-check critical conditions from accumulated data
my $home_ok = grep { /\/home\s*$/ } @{matched()} ? 1 : 0;
# For root, we need to re-parse or rely on previous generator state
# In production, you might store state in config or use streams
print "note: df verification complete\\n";
CODE
Filename: None. Size: 3kb. View raw, , hex, or download this file. Report this file.