Skip to content

Conversation

ZuluPro
Copy link
Contributor

@ZuluPro ZuluPro commented Aug 17, 2017

No description provided.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.003%) to 85.151% when pulling 25b283d on ZuluPro:patch-1 into 3177323 on softlayer:master.

@allmightyspiff
Copy link
Member

The CI check should be fixed in the latest master commit.

Also, are there any presets that can't be ordered here with just their size name?

@kwienken
Copy link
Contributor

@allmightyspiff I do not see anything here that would cause problems with ordering a preset.

I'm not thrilled with allowing an id to be used instead of the size (keyName) since we tend to encourage keyNames over ids. I guess it's not that much of a risk though since a preset id isn't as likely to change as something like a price id.

@ZuluPro
Copy link
Contributor Author

ZuluPro commented Aug 19, 2017

Hello,@kwienken
In fact, I'm using ID because (default) hardware listing doesn't give the preset's name but its ID.

@kwienken
Copy link
Contributor

@ZuluPro in that case I'm fine with using the ID instead of keyName.

Copy link
Member

@allmightyspiff allmightyspiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZuluPro looks good for the most part, if you could do those small changes I requested I'll merge this.

Thanks

'domain': domain,
}

if not isinstance(size, int):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would rather this check be in _get_preset_id

See get_create_options() for valid arguments.
:param string size: server size name
:param string size: server size name or ID
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"or presetId"

@allmightyspiff allmightyspiff self-assigned this Aug 25, 2017
@ZuluPro ZuluPro force-pushed the patch-1 branch 2 times, most recently from 04fc40f to eae491d Compare August 26, 2017 17:40
except SoftLayer.SoftLayerError as err:
if not err.message.startswith('Could not find valid size for'):
raise
size = size
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you asked I check if a size exists with its name before take ID.

I check with try/except, and raise other exceptions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant, modify _get_preset_id to return the valid id based on either a keyName or preset id

def _get_preset_id(package, size):
    """Get the preset id given the keyName of the preset."""
    for preset in package['activePresets']:
        if preset['keyName'] == size:
            return preset['id']
        elif preset['id'] == size:
            return preset['id']

    raise SoftLayer.SoftLayerError("Could not find valid size for: '%s'" % size)

Also, the build scripts need to pass before I will merge a change.
You might need to pull in my new changes in the master branch as I've included some unit test fixes since this request was made.

@ZuluPro
Copy link
Contributor Author

ZuluPro commented Dec 5, 2017

@allmightyspiff @kwienken
Any news ?

@ZuluPro
Copy link
Contributor Author

ZuluPro commented Dec 12, 2017

Any news ?

@allmightyspiff
Copy link
Member

I'm going to address this in #912

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants