Commit 2161a33
committed
Fix record extraction and do not request only deleted records
Commit 0058b6c introduced a bug in how
we retrieve the records, since we introduced the "deleted" filter and
this was filtering out all the instances that are not deleted.
Moreover, the way we were retrieving the results was wrong as only
servers with a changed status within the requested period were
considered for the record building.
We cannot use 'changes-since' in the servers.list() API query, as it
will only include changes that have chanted its status after that date.
Also, we cannot just get all the usages and then query the servers.get()
server by server, as deleted servers are not returned by ths
servers.get() call. What we do now is the following.
1.- List all the deleted servers that changed after the start date
2.- Build the records for the period [start, end]
3.- Get all the usages
4.- Iter over the usages and:
4.1.- get information for non deleted servers
4.2.- do nothing with deleted servers, as we collected in in step (2)
However, usage was eventually correctly reported, as sooner or later one
server may have a changed status and we will generate the record.
In order to get accurate results, accounting records must be regenerated
at sites, possibly month by month, like:
caso-extract --extract-from 2017-01-01 --extract-to 2017-01-31
caso-extract --extract-from 2017-02-01 --extract-to 2017-02-28
(...)
Closes #471 parent ae6eb97 commit 2161a33
2 files changed
+78
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
122 | 141 | | |
123 | 142 | | |
124 | 143 | | |
125 | | - | |
| 144 | + | |
126 | 145 | | |
127 | 146 | | |
128 | 147 | | |
| |||
138 | 157 | | |
139 | 158 | | |
140 | 159 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
159 | 163 | | |
160 | 164 | | |
161 | 165 | | |
162 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
163 | 174 | | |
164 | 175 | | |
165 | 176 | | |
166 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
167 | 184 | | |
| 185 | + | |
168 | 186 | | |
169 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
170 | 195 | | |
171 | 196 | | |
172 | 197 | | |
| |||
185 | 210 | | |
186 | 211 | | |
187 | 212 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
192 | 217 | | |
193 | 218 | | |
194 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
0 commit comments