This file is indexed.

/usr/share/augeas/lenses/dist/tests/test_fai_diskconfig.aug is in augeas-lenses 1.2.0-0ubuntu1.3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
(*
Module: Test_FAI_DiskConfig
  Provides unit tests and examples for the <FAI_DiskConfig> lens.
*)

module Test_FAI_DiskConfig =


(* Test: FAI_DiskConfig.disk_config
   Test <FAI_DiskConfig.disk_config> *)
test FAI_DiskConfig.disk_config get
    "disk_config hda   preserve_always:6,7   disklabel:msdos  bootable:3\n" =

  { "disk_config" = "hda"
                    { "preserve_always"
                              { "1" = "6" }
                              { "2" = "7" } }
                    { "disklabel" = "msdos" }
                    { "bootable" = "3" } }

(* Test: FAI_DiskConfig.volume
   Test <FAI_DiskConfig.volume> *)
test FAI_DiskConfig.volume get
      "primary /boot     20-100        ext3            rw\n" =

    { "primary"
      { "mountpoint" = "/boot" }
      { "size" = "20-100" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" } } }

(* Test: FAI_DiskConfig.volume
   Testing <FAI_DiskConfig.volume> *)
test FAI_DiskConfig.volume get
      "primary swap      1000     swap       sw\n" =

    { "primary"
      { "mountpoint" = "swap" }
      { "size" = "1000" }
      { "filesystem" = "swap" }
      { "mount_options"
        { "1" = "sw" } } }

(* Test: FAI_DiskConfig.volume
   Testing <FAI_DiskConfig.volume> *)
test FAI_DiskConfig.volume get
      "primary /         12000      ext3           rw        createopts=\"-b 2048\"\n" =

    { "primary"
      { "mountpoint" = "/" }
      { "size" = "12000" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" } }
      { "fs_options"
        { "createopts" = "-b 2048" } } }

(* Test: FAI_DiskConfig.volume
   Testing <FAI_DiskConfig.volume> *)
test FAI_DiskConfig.volume get
      "logical /tmp      1000      ext3            rw,nosuid\n" =

    { "logical"
      { "mountpoint" = "/tmp" }
      { "size" = "1000" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" }
        { "2" = "nosuid" } } }

(* Test: FAI_DiskConfig.volume
   Testing <FAI_DiskConfig.volume> *)
test FAI_DiskConfig.volume get
      "logical /var      10%-      ext3               rw\n" =

    { "logical"
      { "mountpoint" = "/var" }
      { "size" = "10%-" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" } } }

(* Test: FAI_DiskConfig.volume
   Testing <FAI_DiskConfig.volume> *)
test FAI_DiskConfig.volume get
      "logical /nobackup 0-        xfs                rw\n" =

    { "logical"
      { "mountpoint" = "/nobackup" }
      { "size" = "0-" }
      { "filesystem" = "xfs" }
      { "mount_options"
        { "1" = "rw" } } }

(* Variable: simple_config
   A simple configuration file *)
let simple_config = "# A comment
disk_config disk2
raw-disk - 0 - -

disk_config lvm
vg my_pv        sda2
vg test		disk1.9
my_pv-_swap     swap    2048    swap    sw
my_pv-_root     /       2048    ext3 rw,errors=remount-ro

disk_config raid
raid1		/boot		disk1.1,disk2.1,disk3.1,disk4.1,disk5.1,disk6.1		ext3	rw
raid1		swap		disk1.2,disk2.2,disk3.2,disk4.2,disk5.2,disk6.2		swap	sw
raid5		/srv/data	disk1.11,disk2.11,disk3.11,disk4.11,disk5.11,disk6.11	ext3	ro		createopts=\"-m 0\"
raid0        -    disk2.2,sdc1,sde1:spare:missing  ext2       default

disk_config tmpfs
tmpfs                           /var/opt/hosting/tmp    500             defaults
"

(* Test: FAI_DiskConfig.lns
   Testing the full <FAI_DiskConfig.lns> on <simple_config> *)
test FAI_DiskConfig.lns get simple_config =
  { "#comment" = "A comment" }
  { "disk_config" = "disk2"
    { "raw-disk"
      { "mountpoint" = "-" }
      { "size" = "0" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
  }
  {  }
  { "disk_config" = "lvm"
    { "vg"
      { "name" = "my_pv" }
      { "disk" = "sda2" }
    }
    { "vg"
      { "name" = "test" }
      { "disk" = "disk1"
        { "partition" = "9" }
      }
    }
    { "lv"
      { "vg" = "my_pv" }
      { "name" = "_swap" }
      { "mountpoint" = "swap" }
      { "size" = "2048" }
      { "filesystem" = "swap" }
      { "mount_options"
        { "1" = "sw" }
      }
    }
    { "lv"
      { "vg" = "my_pv" }
      { "name" = "_root" }
      { "mountpoint" = "/" }
      { "size" = "2048" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" }
        { "2" = "errors"
          { "value" = "remount-ro" }
        }
      }
    }
  }
  {  }
  { "disk_config" = "raid"
    { "raid1"
      { "mountpoint" = "/boot" }
      { "disk" = "disk1"
        { "partition" = "1" }
      }
      { "disk" = "disk2"
        { "partition" = "1" }
      }
      { "disk" = "disk3"
        { "partition" = "1" }
      }
      { "disk" = "disk4"
        { "partition" = "1" }
      }
      { "disk" = "disk5"
        { "partition" = "1" }
      }
      { "disk" = "disk6"
        { "partition" = "1" }
      }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" }
      }
    }
    { "raid1"
      { "mountpoint" = "swap" }
      { "disk" = "disk1"
        { "partition" = "2" }
      }
      { "disk" = "disk2"
        { "partition" = "2" }
      }
      { "disk" = "disk3"
        { "partition" = "2" }
      }
      { "disk" = "disk4"
        { "partition" = "2" }
      }
      { "disk" = "disk5"
        { "partition" = "2" }
      }
      { "disk" = "disk6"
        { "partition" = "2" }
      }
      { "filesystem" = "swap" }
      { "mount_options"
        { "1" = "sw" }
      }
    }
    { "raid5"
      { "mountpoint" = "/srv/data" }
      { "disk" = "disk1"
        { "partition" = "11" }
      }
      { "disk" = "disk2"
        { "partition" = "11" }
      }
      { "disk" = "disk3"
        { "partition" = "11" }
      }
      { "disk" = "disk4"
        { "partition" = "11" }
      }
      { "disk" = "disk5"
        { "partition" = "11" }
      }
      { "disk" = "disk6"
        { "partition" = "11" }
      }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "ro" }
      }
      { "fs_options"
        { "createopts" = "-m 0" }
      }
    }
    { "raid0"
      { "mountpoint" = "-" }
      { "disk" = "disk2"
        { "partition" = "2" }
      }
      { "disk" = "sdc1" }
      { "disk" = "sde1"
        { "spare" }
        { "missing" }
      }
      { "filesystem" = "ext2" }
      { "mount_options"
        { "1" = "default" }
      }
    }
  }
  { }
  { "disk_config" = "tmpfs"
    { "tmpfs"
      { "mountpoint" = "/var/opt/hosting/tmp" }
      { "size" = "500" }
      { "mount_options"
        { "1" = "defaults" }
      }
    }
  }


(* Variable: config1
   Another full configuration *)
let config1 = "disk_config disk1 bootable:1 preserve_always:all always_format:5,6,7,8,9,10,11
primary  -         0   -     -
primary  -         0   -     -
logical  /         0   ext3  rw,relatime,errors=remount-ro   createopts=\"-c -j\"
logical  swap      0   swap  sw
logical  /var      0   ext3  rw,relatime                     createopts=\"-m 5 -j\"
logical  /tmp      0   ext3  rw                              createopts=\"-m 0 -j\"
logical  /usr      0   ext3  rw,relatime                     createopts=\"-j\"
logical  /home     0   ext3  rw,relatime,nosuid,nodev        createopts=\"-m 1 -j\"
logical  /wrk      0   ext3  rw,relatime,nosuid,nodev        createopts=\"-m 1 -j\"
logical  /transfer 0   vfat  rw
"

(* Test: FAI_DiskConfig.lns
   Testing <FAI_DiskConfig.lns> on <config1> *)
test FAI_DiskConfig.lns get config1 =
  { "disk_config" = "disk1"
    { "bootable" = "1" }
    { "preserve_always"
      { "1" = "all" }
    }
    { "always_format"
      { "1" = "5" }
      { "2" = "6" }
      { "3" = "7" }
      { "4" = "8" }
      { "5" = "9" }
      { "6" = "10" }
      { "7" = "11" }
    }
    { "primary"
      { "mountpoint" = "-" }
      { "size" = "0" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
    { "primary"
      { "mountpoint" = "-" }
      { "size" = "0" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
    { "logical"
      { "mountpoint" = "/" }
      { "size" = "0" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" }
        { "2" = "relatime" }
        { "3" = "errors"
          { "value" = "remount-ro" }
        }
      }
      { "fs_options"
        { "createopts" = "-c -j" }
      }
    }
    { "logical"
      { "mountpoint" = "swap" }
      { "size" = "0" }
      { "filesystem" = "swap" }
      { "mount_options"
        { "1" = "sw" }
      }
    }
    { "logical"
      { "mountpoint" = "/var" }
      { "size" = "0" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" }
        { "2" = "relatime" }
      }
      { "fs_options"
        { "createopts" = "-m 5 -j" }
      }
    }
    { "logical"
      { "mountpoint" = "/tmp" }
      { "size" = "0" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" }
      }
      { "fs_options"
        { "createopts" = "-m 0 -j" }
      }
    }
    { "logical"
      { "mountpoint" = "/usr" }
      { "size" = "0" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" }
        { "2" = "relatime" }
      }
      { "fs_options"
        { "createopts" = "-j" }
      }
    }
    { "logical"
      { "mountpoint" = "/home" }
      { "size" = "0" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" }
        { "2" = "relatime" }
        { "3" = "nosuid" }
        { "4" = "nodev" }
      }
      { "fs_options"
        { "createopts" = "-m 1 -j" }
      }
    }
    { "logical"
      { "mountpoint" = "/wrk" }
      { "size" = "0" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "rw" }
        { "2" = "relatime" }
        { "3" = "nosuid" }
        { "4" = "nodev" }
      }
      { "fs_options"
        { "createopts" = "-m 1 -j" }
      }
    }
    { "logical"
      { "mountpoint" = "/transfer" }
      { "size" = "0" }
      { "filesystem" = "vfat" }
      { "mount_options"
        { "1" = "rw" }
      }
    }
  }


(* Variable: config2
   Another full configuration *)
let config2 = "disk_config /dev/sda
primary  -  250M  -  -
primary  -  20G   -  -
logical  -  8G    -  -
logical  -  4G    -  -
logical  -  5G    -  -

disk_config /dev/sdb sameas:/dev/sda

disk_config raid
raid1  /boot  sda1,sdb1  ext3  defaults
raid1  /      sda2,sdb2  ext3  defaults,errors=remount-ro
raid1  swap   sda5,sdb5  swap  defaults
raid1  /tmp   sda6,sdb6  ext3  defaults createopts=\"-m 1\"
raid1  /var   sda7,sdb7  ext3  defaults
"

(* Test: FAI_DiskConfig.lns
   Testing <FAI_DiskConfig.lns> on <config2> *)
test FAI_DiskConfig.lns get config2 =
  { "disk_config" = "/dev/sda"
    { "primary"
      { "mountpoint" = "-" }
      { "size" = "250M" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
    { "primary"
      { "mountpoint" = "-" }
      { "size" = "20G" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
    { "logical"
      { "mountpoint" = "-" }
      { "size" = "8G" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
    { "logical"
      { "mountpoint" = "-" }
      { "size" = "4G" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
    { "logical"
      { "mountpoint" = "-" }
      { "size" = "5G" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
  }
  {  }
  { "disk_config" = "/dev/sdb"
    { "sameas" = "/dev/sda" }
  }
  {  }
  { "disk_config" = "raid"
    { "raid1"
      { "mountpoint" = "/boot" }
      { "disk" = "sda1" }
      { "disk" = "sdb1" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "defaults" }
      }
    }
    { "raid1"
      { "mountpoint" = "/" }
      { "disk" = "sda2" }
      { "disk" = "sdb2" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "defaults" }
        { "2" = "errors"
          { "value" = "remount-ro" }
        }
      }
    }
    { "raid1"
      { "mountpoint" = "swap" }
      { "disk" = "sda5" }
      { "disk" = "sdb5" }
      { "filesystem" = "swap" }
      { "mount_options"
        { "1" = "defaults" }
      }
    }
    { "raid1"
      { "mountpoint" = "/tmp" }
      { "disk" = "sda6" }
      { "disk" = "sdb6" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "defaults" }
      }
      { "fs_options"
        { "createopts" = "-m 1" }
      }
    }
    { "raid1"
      { "mountpoint" = "/var" }
      { "disk" = "sda7" }
      { "disk" = "sdb7" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "defaults" }
      }
    }
  }


(* Variable: config3
   Another full configuration *)
let config3 = "disk_config /dev/sdb
primary  /      21750  ext3  defaults,errors=remount-ro
primary  /boot  250    ext3  defaults
logical  -      4000   -     -
logical  -      2000   -     -
logical  -      10-    -     -

disk_config cryptsetup randinit
swap  swap      /dev/sdb5  swap  defaults
tmp   /tmp      /dev/sdb6  ext2  defaults
luks  /local00  /dev/sdb7  ext3  defaults,errors=remount-ro  createopts=\"-m 0\"
"

(* Test: FAI_DiskConfig.lns
   Testing <FAI_DiskConfig.lns> on <config3> *)
test FAI_DiskConfig.lns get config3 =
  { "disk_config" = "/dev/sdb"
    { "primary"
      { "mountpoint" = "/" }
      { "size" = "21750" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "defaults" }
        { "2" = "errors"
          { "value" = "remount-ro" }
        }
      }
    }
    { "primary"
      { "mountpoint" = "/boot" }
      { "size" = "250" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "defaults" }
      }
    }
    { "logical"
      { "mountpoint" = "-" }
      { "size" = "4000" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
    { "logical"
      { "mountpoint" = "-" }
      { "size" = "2000" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
    { "logical"
      { "mountpoint" = "-" }
      { "size" = "10-" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
  }
  {  }
  { "disk_config" = "cryptsetup"
    { "randinit" }
    { "swap"
      { "mountpoint" = "swap" }
      { "device" = "/dev/sdb5" }
      { "filesystem" = "swap" }
      { "mount_options"
        { "1" = "defaults" }
      }
    }
    { "tmp"
      { "mountpoint" = "/tmp" }
      { "device" = "/dev/sdb6" }
      { "filesystem" = "ext2" }
      { "mount_options"
        { "1" = "defaults" }
      }
    }
    { "luks"
      { "mountpoint" = "/local00" }
      { "device" = "/dev/sdb7" }
      { "filesystem" = "ext3" }
      { "mount_options"
        { "1" = "defaults" }
        { "2" = "errors"
          { "value" = "remount-ro" }
        }
      }
      { "fs_options"
        { "createopts" = "-m 0" }
      }
    }
  }


(* Variable: with_spaces *)
let with_spaces = "disk_config disk2

raw-disk - 0 - -
"

(* Test: FAI_DiskConfig.lns
   Testing <FAI_DiskConfig.lns> with <with_spaces> *)
test FAI_DiskConfig.lns get with_spaces =
  { "disk_config" = "disk2"
    {  }
    { "raw-disk"
      { "mountpoint" = "-" }
      { "size" = "0" }
      { "filesystem" = "-" }
      { "mount_options"
        { "1" = "-" }
      }
    }
  }