Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3+ not supported - Any plans to update? #22

Open
bv300t opened this issue Oct 14, 2022 · 3 comments
Open

Python3+ not supported - Any plans to update? #22

bv300t opened this issue Oct 14, 2022 · 3 comments

Comments

@bv300t
Copy link

bv300t commented Oct 14, 2022

Lambda no longer allows Python2.7. We started looking at upgrading graffiti_monkey to support Python3+. I think requirements and several pieces are going to have to be updated. After updating several "except KeyError, e" and "except Exception, e" to "except KeyError as e" and "except Exception as e" in multiple files for Python3 compatibility, we were able to get beyond several of the errors. I'm not sure if there are other syntax errors, however... there do not appear to be. The last error we cannot get past is:

[ERROR] Runtime.ImportModuleError: Unable to import module 'service': No module named 'cache'
Traceback (most recent call last):

This is not a problem when we are able to use python2.7. I do not see anything trying to import cache in the service.py or the files under the graffiti_monkey folder. However, cache.py does exist under that folder. I'm not sure why the service.py is unable to be imported. Also, Several of the requirements versions appear to not be python3+ compatible... but still digging there.

Are there any plans to update this utility? We are still digging to see if we can get this to work.

@joseph-holland
Copy link
Owner

Hi,
I've not used this utility for several years but since a few people are asking about python 3 support I might take a look at updating this. I'll have a look at this over the next week or so.
Thanks

@bv300t
Copy link
Author

bv300t commented Oct 15, 2022

We were also able to find in core.py - lines 17 and 18 appear they need to be updated from:

from cache import Memorize
from exceptions import *

to:

from graffiti_monkey.cache import Memorize
from graffiti_monkey.exceptions import *

This got us further. However, we are now running into 401 auth issues (messages leading up to errors and a couple after for reference):

2022-10-14 21:56:37,042 - graffiti_monkey.core - INFO - Connecting to region us-east-1 using profile None

2022-10-14 21:56:37,043 - graffiti_monkey.core - INFO - Getting list of all volumes

2022-10-14 21:56:37,277 - boto - ERROR - 401 Unauthorized

2022-10-14 21:56:37,277 - boto - ERROR - b'<?xml version="1.0" encoding="UTF-8"?>\n<Response><Errors><Error><Code>AuthFailure</Code><Message>AWS was not able to validate the provided access credentials</Message></Error></Errors><RequestID>*********************************</RequestID></Response>'

2022-10-14 21:56:37,290 - root - ERROR - Error: Graffiti Monkey encountered the following error: EC2ResponseError: 401 Unauthorized

2022-10-14T17:56:37.290-04:00 <?xml version="1.0" encoding="UTF-8"?>

2022-10-14T17:56:37.290-04:00 <Response><Errors><Error><Code>AuthFailure</Code><Message>AWS was not able to validate the provided access credentials</Message></Error></Errors><RequestID>*****************************</RequestID></Response>

2022-10-14 21:56:37,330 - botocore.credentials - INFO - Found credentials in environment variables.

2022-10-14 21:56:37,550 - botocore.vendored.requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): sns.us-east-1.amazonaws.com

I can confirm, it appears the lambda excution role and iam policies are all correct. This is not processing the EBS / Snapshots as intended in this state. Also, I think some of the requirements and potentially boto usage will have to be updated to Python3 capable utilities and boto3.

Last: the iam policy in the CloudFormation template... I also changed the resources permissions from:

                        "Resource": [
                            "arn:aws:ec2:*:*:instance/*",
                            "arn:aws:ec2:*::snapshot/*",
                            "arn:aws:ec2:*:*:volume/*"

to:


                        "Resource": [
                            "arn:aws:ec2:*:*:instance/*",
                            "arn:aws:ec2:*:*:snapshot/*",
                            "arn:aws:ec2:*:*:volume/*"

**** change on the snapshot line. Not sure if it should be :*::snapshot or :*:*:snapshot. I thought the latter was correct... but might be wrong.

I hope this information helps for Python3. Thank you for looking into this... it's a great utility when running (one of the best utilities imo).

@joseph-holland
Copy link
Owner

joseph-holland commented Oct 15, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants