Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tutelacooldouce/9020bf0798cc1ccb482715529c9eb902 to your computer and use it in GitHub Desktop.
Save tutelacooldouce/9020bf0798cc1ccb482715529c9eb902 to your computer and use it in GitHub Desktop.

Revisions

  1. @renaudhager renaudhager revised this gist Aug 30, 2016. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,9 @@
    curl -s -X GET http://localhost:8080/pdb/query/v4/facts --data-urlencode query@test --data-urlencode 'pretty=true'

    curl -X POST http://localhost:8080/pdb/query/v4/facts \
    -H 'Content-Type:application/json' \
    -d '{"query":["and",["=","certname","FQDN"],["=","name","ipaddress"]]}'

    content of file test :

    ["and",["=","certname","FQDN"],["or",["=","name","ipaddress"]]]
  2. @renaudhager renaudhager revised this gist Aug 30, 2016. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,11 @@
    curl -s -X GET http://localhost:8080/pdb/query/v4/facts --data-urlencode query@test --data-urlencode 'pretty=true'

    content of file test :

    ["and",["=","certname","FQDN"],["or",["=","name","ipaddress"]]]

    ["and",["=","certname","FQDN"],["=","name","ipaddress"]]

    ["and",
    ["=", "name", "bios_version"],
    ["in", "certname",
  3. @renaudhager renaudhager revised this gist Aug 25, 2016. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -35,4 +35,17 @@ Query with mutliple fact with OR :
    ["or",
    ["=", ["fact", "s_role"], "role1"],
    ["=", ["fact", "s_role"], "role2"],
    ["=", ["fact", "s_role"], "role3"]]]]]]
    ["=", ["fact", "s_role"], "role3"]]]]]]


    Query with mutliple fact with OR and AND:
    ["and",
    ["=", "name", "hostname"],
    ["in", "certname",
    ["extract", "certname", ["select_facts",
    ["and",
    ["=", ["fact", "s_datacenter"], "mydc"],
    ["or",
    ["=", ["fact", "s_role"], "role1"],
    ["=", ["fact", "s_role"], "role2"],
    ["=", ["fact", "s_role"], "role3"]]]]]]]
  4. @renaudhager renaudhager revised this gist Aug 25, 2016. No changes.
  5. @renaudhager renaudhager revised this gist Aug 25, 2016. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -33,8 +33,6 @@ Query with mutliple fact with OR :
    ["in", "certname",
    ["extract", "certname", ["select_facts",
    ["or",
    ["=", ["fact", "s_role"], "fe"],
    ["=", ["fact", "s_role"], "fo"],
    ["=", ["fact", "s_role"], "fo2"],
    ["=", ["fact", "s_role"], "be"],
    ["=", ["fact", "s_role"], "parser"]]]]]]
    ["=", ["fact", "s_role"], "role1"],
    ["=", ["fact", "s_role"], "role2"],
    ["=", ["fact", "s_role"], "role3"]]]]]]
  6. @renaudhager renaudhager revised this gist Aug 25, 2016. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -25,4 +25,16 @@ Request 2 facts :
    [ "or",
    ["=", "name", "ipaddress"],
    ["=", "name", "operatingsystem"]
    ]
    ]

    Query with mutliple fact with OR :
    ["and",
    ["=", "name", "hostname"],
    ["in", "certname",
    ["extract", "certname", ["select_facts",
    ["or",
    ["=", ["fact", "s_role"], "fe"],
    ["=", ["fact", "s_role"], "fo"],
    ["=", ["fact", "s_role"], "fo2"],
    ["=", ["fact", "s_role"], "be"],
    ["=", ["fact", "s_role"], "parser"]]]]]]
  7. @renaudhager renaudhager revised this gist Aug 25, 2016. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,10 @@ To get hostname in fact :
    ["and",
    ["=", "name", "hostname"],
    ["in", "certname",
    ["extract", "certname", ["select_facts", ["=", ["fact", "hostname"], "myhostname"] ]]]]
    ["extract", "certname", ["select_facts", ["=", ["fact", "hostname"], "myhostname"] ]]]]

    Request 2 facts :
    [ "or",
    ["=", "name", "ipaddress"],
    ["=", "name", "operatingsystem"]
    ]
  8. @renaudhager renaudhager revised this gist Jul 15, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,4 @@ To get hostname in fact :
    ["and",
    ["=", "name", "hostname"],
    ["in", "certname",
    ["extract", "certname", ["select_facts", ["=", ["fact", "hostname"], "sci-prod-db-ma114"] ]]]]
    ["extract", "certname", ["select_facts", ["=", ["fact", "hostname"], "myhostname"] ]]]]
  9. @renaudhager renaudhager revised this gist Jul 15, 2016. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,10 @@ To select all DELL model
    ["and",
    ["=", "name", "bios_version"],
    ["in", "certname",
    ["extract", "certname", ["select_facts", ["=", ["fact", "manufacturer"], "Dell Inc."] ]]]]
    ["extract", "certname", ["select_facts", ["=", ["fact", "manufacturer"], "Dell Inc."] ]]]]

    To get hostname in fact :
    ["and",
    ["=", "name", "hostname"],
    ["in", "certname",
    ["extract", "certname", ["select_facts", ["=", ["fact", "hostname"], "sci-prod-db-ma114"] ]]]]
  10. @renaudhager renaudhager revised this gist May 17, 2016. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -7,4 +7,10 @@ content of file test :
    ["extract", "certname", ["select_facts",
    ["and",
    ["=", ["fact", "manufacturer"], "Dell Inc."],
    ["=", ["fact", "productname"], "PowerEdge R620"]]]]]]
    ["=", ["fact", "productname"], "PowerEdge R620"]]]]]]

    To select all DELL model
    ["and",
    ["=", "name", "bios_version"],
    ["in", "certname",
    ["extract", "certname", ["select_facts", ["=", ["fact", "manufacturer"], "Dell Inc."] ]]]]
  11. @renaudhager renaudhager created this gist May 17, 2016.
    10 changes: 10 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    curl -s -X GET http://localhost:8080/pdb/query/v4/facts --data-urlencode query@test --data-urlencode 'pretty=true'

    content of file test :
    ["and",
    ["=", "name", "bios_version"],
    ["in", "certname",
    ["extract", "certname", ["select_facts",
    ["and",
    ["=", ["fact", "manufacturer"], "Dell Inc."],
    ["=", ["fact", "productname"], "PowerEdge R620"]]]]]]