Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.35k stars 4.66k forks source link

No way to update HostedService Extended Properties #401

Closed pksorensen closed 10 years ago

pksorensen commented 10 years ago

Was trying to use the Extended Properties for storing meta data about some auto deployed cloud services but failed at updating the Extended Properties in the following matter. service.Properties.ExtendedProperties are manipulated before trying to update.

Problem is that Label or Description needs to be given, but if its not changed from before then the request fails.

I am wondering more what the intention of extended properties are if they are not updatable? (Reading the rest api documentation it do not see to be a bug in WAML but rather a by design type of situation, I am just not sure why the design is like this.)

compute.HostedServices.Update(service.ServiceName, new HostedServiceUpdateParameters { ExtendedProperties = service.Properties.ExtendedProperties, Label = service.Properties.Label, Description = service.Properties.Description, });

https://github.com/Azure/azure-sdk-for-net/issues/401

markcowl commented 10 years ago

@singhkay Please triage

singhkays commented 10 years ago

@s093294 If I understand this correctly, you are unable to update the value of an extended property by using a label or description that you used previously ?

pksorensen commented 10 years ago

Ye, long time ago, so have not tested it since. But the problem was that using the same two descriptions and labels, the update failed, and to update the property bag, i had to alter one of them.

singhkays commented 10 years ago

@s093294 Thanks, we'll triage this @huangpf

huangpf commented 10 years ago

The following test cases passed for me:

compute.HostedServices.Create(
    new HostedServiceCreateParameters
    {
        Location = location,
        Label = serviceDescription,
        Description = serviceLabel,
        ServiceName = serviceName,
        ExtendedProperties = new Dictionary<string, string>
        {
            { "foo1", "bar" },
            { "foo2", "baz" }
        }
    });

compute.HostedServices.Update(
    serviceName,
    new HostedServiceUpdateParameters
    {
        Label = serviceDescription,
        Description = serviceLabel,
        ExtendedProperties = new Dictionary<string, string>
        {
            { "bar", "foo3" },
            { "baz", "foo4" }
        }
    });

compute.HostedServices.Update(
    serviceName,
    new HostedServiceUpdateParameters
    {
        Label = serviceDescription,
        ExtendedProperties = new Dictionary<string, string>
        {
            { "bar", "foo5" },
            { "baz", "foo6" }
        }
    });

compute.HostedServices.Update(
    serviceName,
    new HostedServiceUpdateParameters
    {
        Description = serviceLabel,
        ExtendedProperties = new Dictionary<string, string>
        {
            { "bar", "foo7" },
            { "baz", "foo8" }
        }
    });

compute.HostedServices.Update(
    serviceName,
    new HostedServiceUpdateParameters
    {
        ExtendedProperties = new Dictionary<string, string>
        {
            { "bar", "foo9" },
            { "baz", "foo10" }
        }
    });

compute.HostedServices.Update(
    serviceName,
    new HostedServiceUpdateParameters
    {
        Label = serviceLabel,
        Description = serviceDescription,
        ExtendedProperties = new Dictionary<string, string>
        {
            { "bar", "foo1" },
            { "baz", "foo2" }
        }
    });

@s093294 Please try use the latest library to see whether it's working for you. If not please include more details about the client exception and debug logs for all the service calls.

https://www.nuget.org/packages/Microsoft.WindowsAzure.Management.Compute

Thanks.

pksorensen commented 10 years ago

Thanks. I will verify in the coming week. but looks fine from your tests.

stankovski commented 10 years ago

Closing. Please reopen if the problem is not fixed.