Switch to using CLI for introspection rules
Gate for liberty is using python-ironic-inspector-client 1.2.0. Unused function curl_ins is not deleted, as it's likely to be used the next time we introduce a new API. Change-Id: I019023cb9add125a7c43b94c3a5a5b029f812c51
This commit is contained in:
parent
3cdb38109f
commit
de2108de98
@ -7,35 +7,33 @@ export IRONIC_API_VERSION=${IRONIC_API_VERSION:-latest}
|
||||
# Copied from devstack
|
||||
PRIVATE_NETWORK_NAME=${PRIVATE_NETWORK_NAME:-"private"}
|
||||
|
||||
successful_rule=$(mktemp)
|
||||
cat > "$successful_rule" << EOM
|
||||
{
|
||||
"description": "Successful Rule",
|
||||
"conditions": [
|
||||
{"op": "ge", "field": "memory_mb", "value": 256},
|
||||
{"op": "ge", "field": "local_gb", "value": 1}
|
||||
],
|
||||
"actions": [
|
||||
{"action": "set-attribute", "path": "/extra/rule_success",
|
||||
"value": "yes"}
|
||||
]
|
||||
}
|
||||
EOM
|
||||
|
||||
failing_rule=$(mktemp)
|
||||
cat > "$failing_rule" << EOM
|
||||
{
|
||||
"description": "Failing Rule",
|
||||
"conditions": [
|
||||
{"op": "lt", "field": "memory_mb", "value": 42},
|
||||
{"op": "eq", "field": "local_gb", "value": 0}
|
||||
],
|
||||
"actions": [
|
||||
{"action": "set-attribute", "path": "/extra/rule_success",
|
||||
"value": "no"},
|
||||
{"action": "fail", "message": "This rule should not have run"}
|
||||
]
|
||||
}
|
||||
rules_file=$(mktemp)
|
||||
cat > "$rules_file" << EOM
|
||||
[
|
||||
{
|
||||
"description": "Successful Rule",
|
||||
"conditions": [
|
||||
{"op": "ge", "field": "memory_mb", "value": 256},
|
||||
{"op": "ge", "field": "local_gb", "value": 1}
|
||||
],
|
||||
"actions": [
|
||||
{"action": "set-attribute", "path": "/extra/rule_success",
|
||||
"value": "yes"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Failing Rule",
|
||||
"conditions": [
|
||||
{"op": "lt", "field": "memory_mb", "value": 42},
|
||||
{"op": "eq", "field": "local_gb", "value": 0}
|
||||
],
|
||||
"actions": [
|
||||
{"action": "set-attribute", "path": "/extra/rule_success",
|
||||
"value": "no"},
|
||||
{"action": "fail", "message": "This rule should not have run"}
|
||||
]
|
||||
}
|
||||
]
|
||||
EOM
|
||||
|
||||
expected_cpus=$(openstack flavor show baremetal -f value -c vcpus)
|
||||
@ -81,9 +79,8 @@ for uuid in $nodes; do
|
||||
ironic node-set-provision-state $uuid manage
|
||||
done
|
||||
|
||||
curl_ins DELETE v1/rules
|
||||
curl_ins POST v1/rules "--data-binary @$successful_rule"
|
||||
curl_ins POST v1/rules "--data-binary @$failing_rule"
|
||||
openstack baremetal introspection rule purge
|
||||
openstack baremetal introspection rule import "$rules_file"
|
||||
|
||||
for uuid in $nodes; do
|
||||
ironic node-set-provision-state $uuid inspect
|
||||
@ -114,7 +111,7 @@ while true; do
|
||||
fi
|
||||
done
|
||||
|
||||
curl_ins DELETE v1/rules
|
||||
openstack baremetal introspection rule purge
|
||||
|
||||
function test_swift {
|
||||
# Basic sanity check of the data stored in Swift
|
||||
|
Loading…
Reference in New Issue
Block a user