f5devcentral / f5-puppet

Puppet modules for F5 BIG-IP
Apache License 2.0
13 stars 27 forks source link

f5_license is not properly idempotent. #16

Open alexjfisher opened 7 years ago

alexjfisher commented 7 years ago

exists? always returns false because @property_hash is always empty. As a result, create is called on every run.

alexjfisher commented 7 years ago

I was going to try and fix this, but I appear to be hitting https://devcentral.f5.com/questions/automatic-licensing-via-proxy

I did find another issue though. The API returns a 200 OK even if the operation fails.

curl -v -k -u puppet:puppet https://f5-test-web-lb.example.com/mgmt/tm/sys/license -H 'Content-Type: application/json' -X POST -d '{"command":"install","registrationKey":"FOOBAR"}' | jq
Note: Unnecessary use of -X or --request, POST is already inferred.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 192.168.9.43...
* Connected to f5-test-web-lb.example-int.com (192.168.9.43) port 443 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 597 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
*        server certificate verification SKIPPED
*        server certificate status verification SKIPPED
*        common name: *.example.com (matched)
*        server certificate expiration date OK
*        server certificate activation date OK
*        certificate public key: RSA
*        certificate version: #3
*        subject: CN=*.example.com
*        start date: Mon, 13 Feb 2017 00:00:00 GMT
*        expire date: Sun, 16 Feb 2020 23:59:59 GMT
*        issuer: C=US,O=GeoTrust Inc.,CN=GeoTrust SSL CA - G3
*        compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'puppet'
> POST /mgmt/tm/sys/license HTTP/1.1
> Host: f5-test-web-lb.example.com
> Authorization: Basic cHVwcGV0OnB1cHBldA==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 48
>
} [48 bytes data]
* upload completely sent off: 48 out of 48 bytes
< HTTP/1.1 200 OK
< Date: 10 Nov 2017 10:36:36 UTC
< Server: com.f5.rest.common.RestRequestSender
< Set-Cookie: BIGIPAuthCookie=CF387E311C8CE5EBC75853B1D01F619886C17C1E; path=/; Secure; HttpOnly
< Set-Cookie: BIGIPAuthUsernameCookie=puppet; path=/; Secure; HttpOnly
< X-Frame-Options: SAMEORIGIN
< Strict-Transport-Security: max-age=16070400; includeSubDomains
< Pragma: no-cache
< Cache-Control: no-store, no-cache, must-revalidate
< Expires: -1
< Content-Length: 144
< Content-Type: application/json
< Allow:
< REMOTEROLE: 0
< Local-Ip-From-Httpd: 192.168.9.43
< X-Forwarded-Server: localhost.localdomain
< X-Forwarded-Proto: http
< REMOTECONSOLE: /sbin/nologin
< X-Forwarded-Host: f5-test-web-lb.example.com
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Content-Security-Policy: default-src 'self'  'unsafe-inline' 'unsafe-eval'; img-src 'self'  http://127.4.1.1 http://127.4.2.1
<
{ [144 bytes data]
100   192  100   144  100    48    182     60 --:--:-- --:--:-- --:--:--   182
* Connection #0 to host f5-test-web-lb.example.com left intact
{
  "kind": "tm:sys:license:installstate",
  "command": "install",
  "registrationKey": "FOOBAR",
  "commandResult": "Unknown exception during ping ://:8080\n"
}