wokku-cli 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/wokku/commands/addons.rb +20 -2
- data/lib/wokku/commands/databases.rb +17 -1
- data/lib/wokku/version.rb +1 -1
- data/lib/wokku.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c7d8ff79cbc66dc2a088a04025b47c3c36ec6c0a954c68d02d42ee1dee34d46
|
|
4
|
+
data.tar.gz: 8dbc97b262bf992d0d1b63c4c7f6f876ce43866abcf258d203ad6df8b647b8da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eea912742f7b73ba8e908f4b85308e309882751f6899dfdb6e5161455091e9b18ca788534e91b01341594b0897f16d0046641ae9a4c2a5cd469cead422bc99b4
|
|
7
|
+
data.tar.gz: '019b37db8b1ccdb848f2b80a6da957490405bfd5c72680c4a067735068fb757c936ee7ecdef0affd3eef24d43ed371933bfdd65d3c24a9418c977fd009d4fdd2'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.3 — 2026-06-26
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `databases:create` and `addons:shared:enable` no longer report success optimistically. The CLI used to print "Created"/"Enabled" on any 2xx — including a `202 Accepted` ("queued") — so a database or shared engine that was still provisioning, or that failed afterward, looked done. Both commands now poll until the resource is actually `running` (then "Created"/"ready"), `error` (a clear failure + nonzero exit), or a timeout ("still provisioning — check `wokku addons APP` / `databases:info`"). Poll cadence is tunable via `WOKKU_POLL_ATTEMPTS`/`WOKKU_POLL_INTERVAL`.
|
|
8
|
+
|
|
3
9
|
## 0.5.2 — 2026-06-06
|
|
4
10
|
|
|
5
11
|
### Changed
|
|
@@ -40,8 +40,26 @@ end
|
|
|
40
40
|
register "addons:shared:enable", "Enable a shared engine on an app (usage: wokku addons:shared:enable APP ENGINE). ENGINE: postgres|redis|memcached|rabbitmq|meilisearch" do
|
|
41
41
|
id = ARGV.shift || abort("Usage: wokku addons:shared:enable APP ENGINE")
|
|
42
42
|
engine = ARGV.shift || abort("Missing engine")
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
api(:post, "/apps/#{id}/addons/shared", { engine: engine })
|
|
44
|
+
|
|
45
|
+
attempts = (ENV["WOKKU_POLL_ATTEMPTS"] || "30").to_i
|
|
46
|
+
interval = (ENV["WOKKU_POLL_INTERVAL"] || "2").to_f
|
|
47
|
+
|
|
48
|
+
Wokku::Output.status "Enabling shared #{engine} on #{id} — provisioning…" unless Wokku.quiet
|
|
49
|
+
final = poll_until("/apps/#{id}/addons", attempts: attempts, interval: interval) do |list|
|
|
50
|
+
row = Array(list).find { |a| a["service_type"] == engine && a["shared"] }
|
|
51
|
+
row && %w[running error].include?(row["status"])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
row = Array(final).find { |a| a["service_type"] == engine && a["shared"] }
|
|
55
|
+
case row && row["status"]
|
|
56
|
+
when "running"
|
|
57
|
+
Wokku::Output.status "Shared #{engine} ready on #{id}."
|
|
58
|
+
when "error"
|
|
59
|
+
abort "Shared #{engine} failed to provision on #{id}. See the dashboard or re-run to retry."
|
|
60
|
+
else
|
|
61
|
+
Wokku::Output.status "Shared #{engine} still provisioning on #{id}. Check: wokku addons #{id}"
|
|
62
|
+
end
|
|
45
63
|
end
|
|
46
64
|
|
|
47
65
|
register "addons:shared:disable", "Disable a shared engine on an app (usage: wokku addons:shared:disable APP ENGINE)" do
|
|
@@ -32,7 +32,23 @@ register "databases:create", "Create a database (usage: wokku databases:create N
|
|
|
32
32
|
abort "Missing --type (postgres, mysql, redis, mongo)" unless type
|
|
33
33
|
server = resolve_server(explicit: server)
|
|
34
34
|
data = api(:post, "/databases", { name: name, service_type: type, server_id: server })
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
if data["status"] != "running"
|
|
37
|
+
attempts = (ENV["WOKKU_POLL_ATTEMPTS"] || "15").to_i
|
|
38
|
+
interval = (ENV["WOKKU_POLL_INTERVAL"] || "2").to_f
|
|
39
|
+
data = poll_until("/databases/#{data['name']}", attempts: attempts, interval: interval) do |d|
|
|
40
|
+
%w[running error].include?(d["status"])
|
|
41
|
+
end || { "name" => name, "service_type" => type, "status" => "creating" }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
case data["status"]
|
|
45
|
+
when "running"
|
|
46
|
+
Wokku::Output.status "Created #{data['service_type']} database: #{data['name']}"
|
|
47
|
+
when "error"
|
|
48
|
+
abort "Database '#{data['name']}' failed to provision."
|
|
49
|
+
else
|
|
50
|
+
Wokku::Output.status "Database '#{data['name']}' is still provisioning. Check: wokku databases:info #{data['name']}"
|
|
51
|
+
end
|
|
36
52
|
end
|
|
37
53
|
|
|
38
54
|
register "databases:destroy", "Destroy a database (usage: wokku databases:destroy NAME)" do
|
data/lib/wokku/version.rb
CHANGED
data/lib/wokku.rb
CHANGED
|
@@ -80,6 +80,19 @@ rescue Wokku::ApiClient::NotAuthenticated, Wokku::ApiClient::Timeout,
|
|
|
80
80
|
abort e.message
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
# Poll GET <path> until the block returns truthy (returns that data) or the
|
|
84
|
+
# attempt budget is exhausted (returns nil). interval is injectable so specs
|
|
85
|
+
# can run with no real sleep.
|
|
86
|
+
def poll_until(path, attempts: 30, interval: 2)
|
|
87
|
+
attempts.times do |i|
|
|
88
|
+
data = api(:get, path)
|
|
89
|
+
return data if yield(data)
|
|
90
|
+
|
|
91
|
+
sleep(interval) if interval.positive? && i < attempts - 1
|
|
92
|
+
end
|
|
93
|
+
nil
|
|
94
|
+
end
|
|
95
|
+
|
|
83
96
|
def load_config = Wokku::Config.load
|
|
84
97
|
def save_config(data) = Wokku::Config.save(data)
|
|
85
98
|
def api_url = Wokku::Config.api_url
|