You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Svet <no...@github.com> on 2015/05/11 17:40:34 UTC

[jclouds] Skip malformed image entries returned by Softlayer (#743)

Softlayer will occasionally return an incomplete operating system template entry in the `/SoftLayer_Virtual_Guest/getCreateObjectOptions` call, making it impossible to spin up machines - ignore the incomplete entries which are usually not even relevant.

Snippet of incomplete response in `operatingSystems` array

```
         {
            "itemPrice": {
                "hourlyRecurringFee": ".131",
                "item": {
                    "description": "Windows Server 2012 Datacenter Edition (64bit)"
                },
                "recurringFee": "90.63"
            },
            "template": {
                "id": null
            }
        },
```
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds/pull/743

-- Commit Summary --

  * Skip malformed image entries returned by Softlayer

-- File Changes --

    M providers/softlayer/src/main/java/org/jclouds/softlayer/domain/ContainerVirtualGuestConfiguration.java (27)
    A providers/softlayer/src/test/java/org/jclouds/softlayer/domain/ContainerVirtualGuestConfigurationTest.java (65)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/743.patch
https://github.com/jclouds/jclouds/pull/743.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/743

Re: [jclouds] Skip malformed image entries returned by Softlayer (#743)

Posted by Ignasi Barrera <no...@github.com>.
> +      // },
> +
> +      ContainerVirtualGuestConfigurationOption os = ContainerVirtualGuestConfigurationOption.builder()
> +         .productItemPrice(ProductItemPrice.builder()
> +                 .hourlyRecurringFee(0.131f)
> +                 .recurringFee("90.63")
> +                 .item(ProductItem.builder().description("Windows Server 2012 Datacenter Edition (64bit)").build())
> +                 .build())
> +         .template(VirtualGuest.builder().build())
> +         .build();
> +      ContainerVirtualGuestConfiguration conf = ContainerVirtualGuestConfiguration.builder()
> +         .blockDevices(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of())
> +         .datacenters(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of())
> +         .memory(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of())
> +         .networkComponents(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of())
> +         .operatingSystems(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of(os))

Add another OS to the set, just to verify that only the right ones are ignored.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/743/files#r30147104

Re: [jclouds] Skip malformed image entries returned by Softlayer (#743)

Posted by Ignasi Barrera <no...@github.com>.
Just a few minor comments. Thanks @neykov!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/743#issuecomment-101323750

Re: [jclouds] Skip malformed image entries returned by Softlayer (#743)

Posted by Ignasi Barrera <no...@github.com>.
Closed #743.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/743#event-304304414

Re: [jclouds] Skip malformed image entries returned by Softlayer (#743)

Posted by Andrea Turli <no...@github.com>.
>           @Override
>           public OperatingSystem apply(ContainerVirtualGuestConfigurationOption input) {
> -            return OperatingSystem.builder()
> -                    .id(input.getTemplate().getOperatingSystemReferenceCode())
> -                    .operatingSystemReferenceCode(input.getTemplate().getOperatingSystemReferenceCode())
> -                    .build();
> +            if (input.getTemplate().getOperatingSystemReferenceCode() != null) {

I prefer `fail-fast`so first `== null`, but not strong feelings

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/743/files#r30109652

Re: [jclouds] Skip malformed image entries returned by Softlayer (#743)

Posted by Svet <no...@github.com>.
Addressed all comments.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/743#issuecomment-101630952

Re: [jclouds] Skip malformed image entries returned by Softlayer (#743)

Posted by Andrea Turli <no...@github.com>.
rebuild please

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/743#issuecomment-101163235

Re: [jclouds] Skip malformed image entries returned by Softlayer (#743)

Posted by Ignasi Barrera <no...@github.com>.
Pushed to [master](http://git-wip-us.apache.org/repos/asf/jclouds/commit/68a429f3) and [1.9.x](http://git-wip-us.apache.org/repos/asf/jclouds/commit/6c9915ea). Thanks @neykov!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/743#issuecomment-101816302

Re: [jclouds] Skip malformed image entries returned by Softlayer (#743)

Posted by Ignasi Barrera <no...@github.com>.
> @@ -37,6 +42,9 @@
>  
>     public static final String SWAP_DEVICE = "1";
>  
> +   @Resource
> +   Logger logger = Logger.NULL;

This is not (or it shouldn't be) a Guice managed object, so this will always be `Logger.NULL`, which does nothing. You can remove it.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/743/files#r30146891

Re: [jclouds] Skip malformed image entries returned by Softlayer (#743)

Posted by Ignasi Barrera <no...@github.com>.
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.jclouds.softlayer.domain;
> +
> +import static org.testng.Assert.assertTrue;
> +
> +import java.util.Set;
> +
> +import org.testng.annotations.Test;
> +
> +import com.google.common.collect.ImmutableSet;
> +
> +@Test(singleThreaded = true, groups = "unit")

Does it need to be single-threaded?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/743/files#r30147041