Miserlou / django-aws-billing

Django AWS Usage/Billing Package.
MIT License
14 stars 5 forks source link

KeyError: 'Cost' #8

Closed Miserlou closed 10 years ago

Miserlou commented 10 years ago

This happens when running process_aws_billing without the credentials being set properly - it'd be nicer if this failed in a more elegant way.

zerosoul13 commented 10 years ago

By credentials you mean on the keys on settings file? If so i can work on this and submit send a pull request.

Miserlou commented 10 years ago

Yeah, we just need something to check if the necessary settings aren't None or '' before we call the business logic, and to give a friendly reminder message to set those.

If you send a PR I'll gladly accept it!

On Wed, Apr 9, 2014 at 1:03 PM, ZeroSoul13 notifications@github.com wrote:

By credentials you mean on the keys on settings file? If so i can work on this and submit send a pull request.

Reply to this email directly or view it on GitHubhttps://github.com/Miserlou/django-aws-billing/issues/8#issuecomment-40009948 .

zerosoul13 commented 10 years ago

I'll send it over tonight.

Miserlou commented 10 years ago

Okay, turns out this error is actually caused by something completely different.

At some point, Amazon stopped reporting 'Cost' and started reporting 'BlendedCost' and 'UnblendedCost', breaking the whole package.

0.2.2 includes a quick fix which tries Cost, then falls back on BlendedCost. I'm not super thrilled with this as it breaks symmetry, but I needed this to work right right away today. In the future, BlendedCost, BlendedRate, UnblendedRate and UnblendedCost should all have their own rows in the database.

zerosoul13 commented 10 years ago

Yeah, that's the issue i reported before on #1. To solve this issue I pointed record.cost to data['BlendedCost'] and record.rate to data['BlendedRate'] to give solution to this issue. Though i'm not sure what the implications are. I think BlendedCost includes taxes, right?

2014-04-09 17:40 GMT-07:00 Rich Jones notifications@github.com:

Okay, turns out this error is actually caused by something completely different.

At some point, Amazon stopped reporting 'Cost' and started reporting 'BlendedCost' and 'UnblendedCost', breaking the whole package.

0.2.2 includes a quick fix which tries Cost, then falls back on BlendedCost. I'm not super thrilled with this as it breaks symmetry, but I needed this to work right right away today. In the future, BlendedCost, BlendedRate, UnblendedRate and UnblendedCost should all have their own rows in the database.

Reply to this email directly or view it on GitHubhttps://github.com/Miserlou/django-aws-billing/issues/8#issuecomment-40032455 .

Linux User # 453324 Archbang user.

Miserlou commented 10 years ago

Running fine on a remote cloud service for me now at version 0.2.5, both via manage.py and programmatically.