Fixing Issue with set_distribution_config #20

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@zoxa
zoxa commented Jan 23, 2012

When trying to Enable/Disable AWS via set_distribution_config getting the following error:
"1 validation error detected: Value null at 'distributionConfig.customOrigin.originProtocolPolicy' failed to satisfy constraint: Member must not be null"
This addition fixes the issue.

@zoxa zoxa Copying CustomOrigin->OriginProtocolPolicy
When trying to Enable/Disable AWS via set_distribution_config getting the following error:
"1 validation error detected: Value null at 'distributionConfig.customOrigin.originProtocolPolicy' failed to satisfy constraint: Member must not be null"
This addition fixes the issue.
76a23b8
@skyzyx
Contributor
skyzyx commented Feb 1, 2012

Reviewing...

Could you provide the smallest possible code snippet that reproduces this issue? I'd like to write up a test for this.

@skyzyx
Contributor
skyzyx commented Feb 2, 2012

Merging.

@skyzyx skyzyx closed this Feb 2, 2012
@zoxa
zoxa commented Feb 2, 2012

This is a peace from my project. $enable is boolean

$enable = true;
$cdn = new AmazonCloudFront();
$existing_xml = $cdn->get_distribution_config($id);
// Fetch an updated ETag value
$etag = $existing_xml->header['etag'];
// Was the request successful?
if ($existing_xml->isOK())
{
// Generate an updated XML config...
$updated_xml = $cdn->update_config_xml($existing_xml, array('Enabled' => $enable));
// Set the updated config XML to the distribution.
$response = $cdn->set_distribution_config($id, $updated_xml, $etag);

var_dump( $response->isOK() ); // << this is to Asset, without fix you will be getting error:
// "distributionConfig.customOrigin.originProtocolPolicy"

}

Also as result i will suggest to compare string/structure of $existing_xml vs $updated_xml, because
->update_config_xml doesn't update current config, it is rebuilds it based on it own logic.

For Unit tests and library behaviour logic. Shouldn't those two be equal?

$cdn->update_config_xml($existing_xml, array()) == (string) $existing_xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment