cannot concatenate 'str' and 'NoneType' objects
yathi opened this issue · 3 comments
I am trying to get the bees to attack. This is my first time using them. When I run :
bees.attack('myurlhere', 2, 2)
I get:
Traceback (most recent call last):
File "beesTest.py", line 43, in <module>
bees.attack('https://api.rewardops.net/api/v4/auth/token', 2, 2)
File "/Library/Python/2.7/site-packages/beeswithmachineguns/bees.py", line 673, in attack
username, key_name, zone, instance_ids = _read_server_list(options.get('zone'))
File "/Library/Python/2.7/site-packages/beeswithmachineguns/bees.py", line 69, in _read_server_list
MR_STATE_FILENAME = _get_new_state_file_name(mr_zone[-1])
File "/Library/Python/2.7/site-packages/beeswithmachineguns/bees.py", line 1267, in _get_new_state_file_name
return STATE_FILENAME+'.'+zone
TypeError: cannot concatenate 'str' and 'NoneType' objects
I also tried providing an options where the option looks like : {u'post_file': u'data.json', u'contenttype': u'application/json'}
and then I do the attack with:
bees.attack('myurlhere', 2,2, **options)
But that also gives me the same error.
I am on:
- Mac OSX 10.11.16
- Python 2.7.10
I installed bees using pip install git+git://github.com/newsapps/beeswithmachineguns.git
Same for me
Adding "zone":"<availability zone>"
to my options helped me get past this error. Replace <availability zone>
with the availability zone your ec2 instance will be in. It should match the availability zone of your security group.
Configure your sOptions with zone
in it. Example,
sOptions = '{"post_file":"payload.json","contenttype":"application/json", "zone": "us-east-1b"}'
options = json.loads(sOptions)
bees.up(1,'bees-sg','us-east-1b','ami-xxxxx','m3.medium','ubuntu','us-east-1','subnet-xxxxx','hello=test','0.02')
bees.attack('https://10.0.0.1:443',2,2,**options)
Value for zone
should be same as value provided during bees.up