Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Cleared the backend certificate create function
Browse files Browse the repository at this point in the history
  • Loading branch information
kyolee310 committed Apr 2, 2015
1 parent b79a13b commit 9dc04e4
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions eucaconsole/views/elbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,37 +483,26 @@ def handle_backend_certificate_create(self, elb_name):
backend_certificates_json = self.request.params.get('backend_certificates')
backend_certificates = json.loads(backend_certificates_json) if backend_certificates_json else []
public_policy_attributes = dict()
backend_policy_attributes = dict()
public_policy_type = u'PublicKeyPolicyType'
backend_policy_type = u'BackendServerAuthenticationPolicyType'

# TEMP
# backend_certificates = [{"name":"test-backend-pubkey-0001","certificateBody":"-----BEGIN CERTIFICATE-----\nMIIDNDCCAhygAwIBAgIGIPPz3M6BMA0GCSqGSIb3DQEBDQUAMEExCzAJBgNVBAYT\nAlVTMQ0wCwYDVQQKEwRVc2VyMRMwEQYDVQQLEwpFdWNhbHlwdHVzMQ4wDAYDVQQD\nEwVhZG1pbjAeFw0xNDA0MTAxOTIwMjJaFw0xOTA0MTAxOTIwMjJaMEExCzAJBgNV\nBAYTAlVTMQ0wCwYDVQQKEwRVc2VyMRMwEQYDVQQLEwpFdWNhbHlwdHVzMQ4wDAYD\nVQQDEwVhZG1pbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALutKPbt\nDhEQVRw1ZIgaOiA1BdYFssQ9bnhEfC7Lq68hK42lH+K1Rmr/803nuhktITVMvb7R\njFxkYXDi1BZtjgMssWm3K8UegyQb098uScYixK7M/g60/SSbzS2b6ga2Tc4aLg9B\n+YT5d1llqB/W4t19NkqB2ncuk7weB+UYh2PNOHGh+/haLz9/vHOIRerRMyd77q1W\nCQ24HDA/j3sXaNLS/cTe2iVJZWdpb9V57ivVlh+J4ZZqq2mBYCIVwA660/clqJcT\nLu7OsQ4eUHTEEpaUF8EQYMFm4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CCAQoCggEBALutKPbt\nDhEQVRw1ZIgaOiA1BdYFssQ9bnhEfC7Lq68hK42lH+K1Rmr/803nuhktITVMvb7R\njFxkYXDi1BZtjgMssWm3K8UegyQb098uScYixK7M/g60/SSbzS2b6ga2Tc4aLg9B\n+YT5d1llqB/W4t19NkqB2ncuk7weB+UYh2PNOHGh+/haLz9/vHOIRerRMyd77q1W\nCQ24HDA/j3sXaNLS/cTe2iVJZWdpb9V57ivVlh+J4ZZqq2mBYCIVwA660/clqJcT\nLu7OsQ4eUHTEEpaUF8EQYMFm4FXNwxLZd7nBdBA97Ip2prvkIrW7WsWXrf0oH6If\nq4ZuDhuTThkGcI8CAwEAAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU\n4UfCYeA290g+BSzSvavJhv7CU6wwDQYJKoZIhvcNAQENBQADggEBAFghqNx0YSIA\nwZad3vaEkCVDmgOyL0m4NyJU0uAl+rtFKuR1fv0lIR22zLG5Pw6UH/7fS1TBw7Kc\nCiDF+eYfkKM9e7mf45iukIF1GuTRXcKFk9Nop0Il0bi9Jas+vhidlVyO7VjHbicW\nIcCFXiOx5KDA9yhKiHGBU6SGxQUdijE+S2+XsvtOqNGGezzFCc/colQXXyOdxvM2\njLVUgVctURXeDJsKuO1Drq0Iy5opTc2XE0WzZ4AxVAuC5UdYIfJ1XzjRRqDIf5+r\n2n1Mf5mLBmhzSXpd6cdDiK7YNt1uGK4ydOt/z2FYLBl9cVJoWG5zRMbJuiFdwIlw\nhW/GWUvLKJQ=\n-----END CERTIFICATE-----"}]

backend_policy_name = u'BackendPolicy-{0}'.format(elb_name)
print backend_policy_name
backend_policy_params = {'LoadBalancerName': elb_name,
'PolicyName': backend_policy_name,
'PolicyTypeName': backend_policy_type}
index = 1
for cert in backend_certificates:
public_policy_name = u'EucaConsole-PublicKeyPolicy-{0}'.format(cert.get('name'))
public_policy_attributes['PublicKey'] = cert.get('certificateBody')
print public_policy_name
self.elb_conn.create_lb_policy(elb_name, public_policy_name, public_policy_type, public_policy_attributes)
backend_policy_params['PolicyAttributes.member.%d.AttributeName' % index] = 'PublicKeyPolicyName'
backend_policy_params['PolicyAttributes.member.%d.AttributeValue' % index] = public_policy_name
index += 1

# Cannot use the boto call below
# since it won't allow having multiple 'PublicKeyPolicyName' keys as the attributes
# backend_policy_attributes['PublicKeyPolicyName'] = public_policy_name
# self.elb_conn.create_lb_policy(elb_name, backend_policy_name, backend_policy_type, backend_policy_attributes)
print backend_policy_params
self.elb_conn.get_status('CreateLoadBalancerPolicy', backend_policy_params)
print "Created elb policy"
# sleep is needed for the previous policy creation to complete
time.sleep(1)
instance_port = 443
self.elb_conn.set_lb_policies_of_backend_server(elb_name, instance_port, backend_policy_name)
print "Done setting up backend cert"

0 comments on commit 9dc04e4

Please sign in to comment.