File: strftime.cf

package info (click to toggle)
cfengine3 3.24.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,552 kB
  • sloc: ansic: 163,161; sh: 10,296; python: 2,950; makefile: 1,744; lex: 784; yacc: 633; perl: 211; pascal: 157; xml: 21; sed: 13
file content (84 lines) | stat: -rw-r--r-- 1,844 bytes parent folder | download | duplicates (2)
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
#######################################################
#
# Test strftime()
#
#######################################################

body common control
{
      inputs => { "../../default.cf.sub" };
      bundlesequence  => { default("$(this.promise_filename)") };
      version => "1.0";
}

#######################################################

bundle agent init
{
  vars:
      # we don't use locale-sensitive formats!
      "results" slist => { "1973-03-03 09:46:40", "124 1 18 200000000", $(dow) };

    Monday::
      "dow" string => "1";
    Tuesday::
      "dow" string => "2";
    Wednesday::
      "dow" string => "3";
    Thursday::
      "dow" string => "4";
    Friday::
      "dow" string => "5";
    Saturday::
      "dow" string => "6";
    Sunday::
      "dow" string => "0";

  files:
      "$(G.testfile).expected"
      create => "true",
      edit_line => init_insert;
}

bundle edit_line init_insert
{
  insert_lines:
      "$(init.results)";
}

#######################################################

bundle agent test
{
    meta:
      "test_soft_fail" string => "windows",
        meta => { "ENT-10253" };

  vars:
      "vals" slist => {
                        strftime('gmtime', '%F %T', 100000000),
                        strftime('localtime', '%j %w %W %s', 200000000),
                        strftime('localtime', '%w', now()),
      };

  files:
      "$(G.testfile).actual"
      create => "true",
      edit_line => test_insert;
}

bundle edit_line test_insert
{
  insert_lines:
      "$(test.vals)";
}

#######################################################

bundle agent check
{
  methods:
      "any" usebundle => sorted_check_diff("$(G.testfile).actual",
                                           "$(G.testfile).expected",
                                           "$(this.promise_filename)");
}