Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: softlayer/softlayer-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.2.0
Choose a base ref
...
head repository: softlayer/softlayer-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.2.1
Choose a head ref
  • 9 commits
  • 10 files changed
  • 2 contributors

Commits on May 2, 2024

  1. Fixed #2144

    allmightyspiff committed May 2, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e249b32 View commit details
  2. trying to force unix line endings all the time forever

    allmightyspiff committed May 2, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    sothawo Peter-Josef Meisch
    Copy the full SHA
    78e3abf View commit details
  3. Merge pull request #2145 from allmightyspiff/issues2144

    Fixed an issue with confirmation not handling uppercase ids
    allmightyspiff authored May 2, 2024
    Copy the full SHA
    6ce7991 View commit details

Commits on May 9, 2024

  1. Copy the full SHA
    1e8725d View commit details
  2. Fixed a few config remembering issues

    allmightyspiff committed May 9, 2024
    Copy the full SHA
    97d34f7 View commit details

Commits on May 10, 2024

  1. Fixed tox issues

    allmightyspiff committed May 10, 2024
    Copy the full SHA
    c753641 View commit details
  2. Merge pull request #2147 from allmightyspiff/emploginupdates

    Emploginupdates
    allmightyspiff authored May 10, 2024
    Copy the full SHA
    0c6520b View commit details

Commits on May 13, 2024

  1. V6.2.1 updates

    allmightyspiff committed May 13, 2024
    Copy the full SHA
    55312da View commit details
  2. Merge pull request #2148 from allmightyspiff/master

    V6.2.1 updates
    allmightyspiff authored May 13, 2024
    Copy the full SHA
    fa6e642 View commit details
Showing with 82 additions and 169 deletions.
  1. +1 −0 .gitattributes
  2. +11 −6 SoftLayer/API.py
  3. +6 −11 SoftLayer/CLI/file/cancel.py
  4. +1 −1 SoftLayer/CLI/formatting.py
  5. +2 −3 SoftLayer/CLI/login.py
  6. +8 −1 SoftLayer/config.py
  7. +1 −1 SoftLayer/consts.py
  8. +40 −131 SoftLayer/managers/storage.py
  9. +1 −1 setup.py
  10. +11 −14 tests/CLI/helper_tests.py
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
*.* text eol=lf

# Language aware diff headers
# https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more
17 changes: 11 additions & 6 deletions SoftLayer/API.py
Original file line number Diff line number Diff line change
@@ -191,7 +191,7 @@ def employee_client(username=None,
if url is not None and '/rest' in url:
# If this looks like a rest endpoint, use the rest transport
transport = transports.RestTransport(
endpoint_url=settings.get('endpoint_url'),
endpoint_url=url,
proxy=settings.get('proxy'),
timeout=settings.get('timeout'),
user_agent=user_agent,
@@ -200,7 +200,7 @@ def employee_client(username=None,
else:
# Default the transport to use XMLRPC
transport = transports.XmlRpcTransport(
endpoint_url=settings.get('endpoint_url'),
endpoint_url=url,
proxy=settings.get('proxy'),
timeout=settings.get('timeout'),
user_agent=user_agent,
@@ -215,11 +215,11 @@ def employee_client(username=None,
# Assume access_token is valid for now, user has logged in before at least.
if access_token and user_id:
auth = slauth.EmployeeAuthentication(user_id, access_token)
return EmployeeClient(auth=auth, transport=transport)
return EmployeeClient(auth=auth, transport=transport, config_file=config_file)
else:
# This is for logging in mostly.
LOGGER.info("No access_token or userid found in settings, creating a No Auth client for now.")
return EmployeeClient(auth=None, transport=transport)
return EmployeeClient(auth=None, transport=transport, config_file=config_file)


def Client(**kwargs):
@@ -250,6 +250,11 @@ def __setAuth(self, auth=None):

def __setTransport(self, transport=None):
"""Prepares the transport property"""
verify = self.settings['softlayer'].get('verify')
if verify == "False":
verify = False
elif verify == "True":
verify = True
if transport is None:
url = self.settings['softlayer'].get('endpoint_url')
if url is not None and '/rest' in url:
@@ -260,7 +265,7 @@ def __setTransport(self, transport=None):
# prevents an exception incase timeout is a float number.
timeout=int(self.settings['softlayer'].getfloat('timeout', 0)),
user_agent=consts.USER_AGENT,
verify=self.settings['softlayer'].getboolean('verify'),
verify=verify,
)
else:
# Default the transport to use XMLRPC
@@ -269,7 +274,7 @@ def __setTransport(self, transport=None):
proxy=self.settings['softlayer'].get('proxy'),
timeout=int(self.settings['softlayer'].getfloat('timeout', 0)),
user_agent=consts.USER_AGENT,
verify=self.settings['softlayer'].getboolean('verify'),
verify=verify,
)

self.transport = transport
17 changes: 6 additions & 11 deletions SoftLayer/CLI/file/cancel.py
Original file line number Diff line number Diff line change
@@ -12,10 +12,8 @@
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('volume-id')
@click.option('--reason', help="An optional reason for cancellation")
@click.option('--immediate',
is_flag=True,
help="Cancels the file storage volume immediately instead "
"of on the billing anniversary")
@click.option('--immediate', is_flag=True,
help="Cancels the file storage volume immediately instead of on the billing anniversary")
@click.option('--force', default=False, is_flag=True, help="Force modify")
@environment.pass_env
def cli(env, volume_id, reason, immediate, force):
@@ -32,15 +30,12 @@ def cli(env, volume_id, reason, immediate, force):
if not (env.skip_confirmations or formatting.no_going_back(volume_id)):
raise exceptions.CLIAbort('Aborted.')

cancelled = file_storage_manager.cancel_file_volume(volume_id,
reason, immediate)
cancelled = file_storage_manager.cancel_file_volume(volume_id, reason, immediate)

if cancelled:
if immediate:
click.echo('File volume with id %s has been marked'
' for immediate cancellation' % volume_id)
click.echo(f'File volume with id {volume_id} has been marked for immediate cancellation')
else:
click.echo('File volume with id %s has been marked'
' for cancellation' % volume_id)
click.echo(f'File volume with id {volume_id} has been marked for cancellation')
else:
click.echo('Unable to cancle file volume %s' % volume_id)
click.echo(f'Unable to cancle file volume {volume_id}')
2 changes: 1 addition & 1 deletion SoftLayer/CLI/formatting.py
Original file line number Diff line number Diff line change
@@ -262,7 +262,7 @@ def no_going_back(confirmation):
prompt = f"This action cannot be undone! Type '{confirmation}' or press Enter to abort"

ans = click.prompt(prompt, default='', show_default=False)
if ans.lower() == str(confirmation):
if ans.lower() == str(confirmation).lower():
return True

return False
5 changes: 2 additions & 3 deletions SoftLayer/CLI/login.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import environment
from SoftLayer import config
from SoftLayer import consts


def censor_password(value):
@@ -31,7 +30,7 @@ def cli(env):
username = settings.get('username') or os.environ.get('SLCLI_USER', None)
password = os.environ.get('SLCLI_PASSWORD', '')
yubi = None
client = employee_client()
client = employee_client(config_file=env.config_file)

# Might already be logged in, try and refresh token
if settings.get('access_token') and settings.get('userid'):
@@ -49,7 +48,7 @@ def cli(env):
except Exception as ex:
print("Error with Hash Authentication, try with password: {}".format(ex))

url = settings.get('endpoint_url') or consts.API_EMPLOYEE_ENDPOINT
url = settings.get('endpoint_url')
click.echo("URL: {}".format(url))
if username is None:
username = input("Username: ")
9 changes: 8 additions & 1 deletion SoftLayer/config.py
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ def get_client_settings_config_file(**kwargs): # pylint: disable=inconsistent-r
config.read(config_files)

if config.has_section('softlayer'):
return {
r_config = {
'endpoint_url': config.get('softlayer', 'endpoint_url'),
'timeout': config.getfloat('softlayer', 'timeout'),
'proxy': config.get('softlayer', 'proxy'),
@@ -76,6 +76,13 @@ def get_client_settings_config_file(**kwargs): # pylint: disable=inconsistent-r
'access_token': config.get('softlayer', 'access_token'),
'verify': config.get('softlayer', 'verify')
}
if r_config["verify"].lower() == "true":
r_config["verify"] = True
elif r_config["verify"].lower() == "false":
r_config["verify"] = False
elif isinstance(r_config["verify"], str):
os.environ['SSL_CERT_FILE'] = r_config["verify"]
return r_config


SETTING_RESOLVERS = [get_client_settings_args,
2 changes: 1 addition & 1 deletion SoftLayer/consts.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
:license: MIT, see LICENSE for more details.
"""
VERSION = 'v6.2.0'
VERSION = 'v6.2.1'
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/'
API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/'
API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/'
Loading