Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pyrax/autoscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# License for the specific language governing permissions and limitations
# under the License.

import base64

import pyrax
from pyrax.client import BaseClient
from pyrax.cloudloadbalancers import CloudLoadBalancer
Expand Down Expand Up @@ -766,6 +768,10 @@ def _create_body(self, name, cooldown, min_entities, max_entities,
metadata = {}
if personality is None:
personality = []
else:
for file in personality:
if 'contents' in file:
file['contents'] = base64.b64encode(file['contents'])
if scaling_policies is None:
scaling_policies = []
group_config = self._create_group_config_body(name, cooldown,
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/test_autoscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ def test_mgr_create_body(self):
flavor = utils.random_unicode()
disk_config = None
metadata = None
personality = None
personality = [{'path': '/tmp/testing', 'contents': 'testtest'}]
scaling_policies = None
networks = utils.random_unicode()
lb = fakes.FakeLoadBalancer()
Expand All @@ -1119,7 +1119,8 @@ def test_mgr_create_body(self):
"imageRef": image,
"metadata": {},
"name": server_name,
"personality": [],
"personality": [{'path': '/tmp/testing',
'contents': 'dGVzdHRlc3Q='}],
"networks": networks,
"key_name": key_name}
},
Expand Down