Skip to content

Navigation Menu

Sign up

added info on bmi and vsi (owner field) #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chechuironman wants to merge 14 commits into softlayer:master from chechuironman:master
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
2ffa7b7
added info on bmi and vsi (owner field)
Jun 30, 2014
5709a7d
tox passed
Jul 7, 2014
7d51723
error on orderItem
Jul 8, 2014
c9d9c36
test added but fail
Jul 8, 2014
55ebdf1
Fix missing var test error
underscorephil Jul 30, 2014
475bd30
Fix missing price test error
underscorephil Jul 30, 2014
683e419
pep8 fixes
underscorephil Jul 30, 2014
d873a18
Merge pull request #1 from underscorephil/test-fix
chechuironman Jul 30, 2014
27667d8
Merge pull request #369 from sudorandom/pep8-fix
sudorandom Aug 1, 2014
954d43f
Fix merge conflicts
underscorephil Aug 4, 2014
c1ff0ec
Fix missing lib prefixes
underscorephil Aug 4, 2014
3e1934c
Add blank return for missing owners on VSI
underscorephil Aug 4, 2014
09a9021
Merge branch 'chechuironman-master'
underscorephil Aug 4, 2014
be40580
Merge pull request #2 from underscorephil/master
chechuironman Aug 4, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions SoftLayer/CLI/modules/server.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@


class ListServers(environment.CLIRunnable):

"""
usage: sl server list [options]

Expand Down Expand Up @@ -88,12 +89,18 @@ def execute(self, args):
'memory',
'primary_ip',
'backend_ip',
'active_transaction'
'active_transaction',
'owner'

@sudorandom sudorandom Jun 30, 2014

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add a trailing comma here to avoid having to modify unrelated lines to add new items?

@chechuironman chechuironman Jun 30, 2014

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mmm sorry Im new in all of this, and not a real developer :(
I tried to install tox with the commands you mentioned before, but I got this:

Could not open requirements file: [Errno 2] No such file or directory: 'test-requirements'
Storing debug log for failure in /Users/chechu/Library/Logs/pip.log

@sudorandom sudorandom Jun 30, 2014

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My fault. tests-requirements.txt is in the tools directory. So it should be pip install -r tools/requirement.txt

])
table.sortby = args.get('--sortby') or 'host'

for server in servers:
server = utils.NestedDict(server)
user = None
if 'billingItem' in server:
if 'orderItem' in server['billingItem']:
user = (server['billingItem']['orderItem']['order']
['userRecord']['username'])
table.add_row([
server['id'],
server['datacenter']['name'] or formatting.blank(),
Expand All @@ -103,12 +110,14 @@ def execute(self, args):
server['primaryIpAddress'] or formatting.blank(),
server['primaryBackendIpAddress'] or formatting.blank(),
formatting.active_txn(server),
user or formatting.blank(),
])

return table


class ServerDetails(environment.CLIRunnable):

"""
usage: sl server detail [--passwords] [--price] <identifier> [options]

Expand Down Expand Up @@ -156,10 +165,17 @@ def execute(self, args):
result['operatingSystem']['softwareLicense']
['softwareDescription']['name'] or formatting.blank()
)])
table.add_row(['created',
result['provisionDate'] or formatting.blank()])

vlan_table = formatting.Table(['type', 'number', 'id'])
table.add_row(['created', result['provisionDate'] or formatting.blank()])
user = None
if 'billingItem' in result:
if 'orderItem' in result['billingItem']:
user = (result['billingItem']['orderItem']['order']
['userRecord']['username'])
table.add_row(['owner',
user or formatting.blank()])
vlan_table = Table(['type', 'number', 'id'])

for vlan in result['networkVlans']:
vlan_table.add_row([
vlan['networkSpace'], vlan['vlanNumber'], vlan['id']])
Expand Down Expand Up @@ -199,6 +215,7 @@ def execute(self, args):


class ServerReload(environment.CLIRunnable):

"""
usage: sl server reload <identifier> [--key=KEY...] [options]

Expand Down Expand Up @@ -231,6 +248,7 @@ def execute(self, args):


class CancelServer(environment.CLIRunnable):

"""
usage: sl server cancel <identifier> [options]

Expand Down Expand Up @@ -264,6 +282,7 @@ def execute(self, args):


class ServerCancelReasons(environment.CLIRunnable):

"""
usage: sl server cancel-reasons

Expand All @@ -286,6 +305,7 @@ def execute(self, args):


class ServerPowerOff(environment.CLIRunnable):

"""
usage: sl server power-off <identifier> [options]

Expand All @@ -308,6 +328,7 @@ def execute(self, args):


class ServerReboot(environment.CLIRunnable):

"""
usage: sl server reboot <identifier> [--hard | --soft] [options]

Expand Down Expand Up @@ -340,6 +361,7 @@ def execute(self, args):


class ServerPowerOn(environment.CLIRunnable):

"""
usage: sl server power-on <identifier> [options]

Expand All @@ -356,6 +378,7 @@ def execute(self, args):


class ServerPowerCycle(environment.CLIRunnable):

"""
usage: sl server power-cycle <identifier> [options]

Expand All @@ -379,6 +402,7 @@ def execute(self, args):


class NicEditServer(environment.CLIRunnable):

"""
usage: sl server nic-edit <identifier> (public | private) --speed=SPEED
[options]
Expand All @@ -403,6 +427,7 @@ def execute(self, args):


class ListChassisServer(environment.CLIRunnable):

"""
usage: sl server list-chassis [options]

Expand All @@ -425,6 +450,7 @@ def execute(self, args):


class ServerCreateOptions(environment.CLIRunnable):

"""
usage: sl server create-options <chassis_id> [options]

Expand Down Expand Up @@ -757,6 +783,7 @@ def _generate_windows_code(self, description):


class CreateServer(environment.CLIRunnable):

"""
usage: sl server create [--disk=SIZE...] [--key=KEY...] [options]

Expand Down Expand Up @@ -1021,6 +1048,7 @@ def _get_price_id_from_options(self, ds_options, option, value,


class EditServer(environment.CLIRunnable):

"""
usage: sl server edit <identifier> [options]

Expand Down
25 changes: 24 additions & 1 deletion SoftLayer/CLI/modules/vs.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@


class ListVSIs(environment.CLIRunnable):

"""
usage: sl vs list [--hourly | --monthly] [--sortby=SORT_COLUMN] [--tags=TAGS]
[options]
Expand Down Expand Up @@ -93,7 +94,7 @@ def execute(self, args):
table = formatting.Table([
'id', 'datacenter', 'host',
'cores', 'memory', 'primary_ip',
'backend_ip', 'active_transaction',
'backend_ip', 'active_transaction', 'owner'
])
table.sortby = args.get('--sortby') or 'host'

Expand All @@ -108,12 +109,15 @@ def execute(self, args):
guest['primaryIpAddress'] or formatting.blank(),
guest['primaryBackendIpAddress'] or formatting.blank(),
formatting.active_txn(guest),
guest['billingItem']['orderItem']['order']
['userRecord']['username'] or formatting.blank(),
])

return table


class VSDetails(environment.CLIRunnable):

"""
usage: sl vs detail [--passwords] [--price] <identifier> [options]

Expand Down Expand Up @@ -173,6 +177,10 @@ def execute(self, args):
table.add_row(['private_cpu', result['dedicatedAccountHostOnlyFlag']])
table.add_row(['created', result['createDate']])
table.add_row(['modified', result['modifyDate']])
table.add_row(['owner', FormattedItem(
lookup(result, 'billingItem', 'orderItem',
'order', 'userRecord', 'username'),
)])

vlan_table = formatting.Table(['type', 'number', 'id'])
for vlan in result['networkVlans']:
Expand Down Expand Up @@ -213,6 +221,7 @@ def execute(self, args):


class CreateOptionsVS(environment.CLIRunnable):

"""
usage: sl vs create-options [options]

Expand Down Expand Up @@ -339,6 +348,7 @@ def add_block_rows(disks, name):


class CreateVS(environment.CLIRunnable):

"""
usage: sl vs create [--disk=SIZE...] [--key=KEY...] [options]

Expand Down Expand Up @@ -641,6 +651,7 @@ def _parse_create_args(self, args):


class ReadyVS(environment.CLIRunnable):

"""
usage: sl vs ready <identifier> [options]

Expand All @@ -667,6 +678,7 @@ def execute(self, args):


class ReloadVS(environment.CLIRunnable):

"""
usage: sl vs reload <identifier> [--key=KEY...] [options]

Expand Down Expand Up @@ -700,6 +712,7 @@ def execute(self, args):


class CancelVS(environment.CLIRunnable):

"""
usage: sl vs cancel <identifier> [options]

Expand All @@ -721,6 +734,7 @@ def execute(self, args):


class VSPowerOff(environment.CLIRunnable):

"""
usage: sl vs power-off <identifier> [--hard] [options]

Expand Down Expand Up @@ -750,6 +764,7 @@ def execute(self, args):


class VSReboot(environment.CLIRunnable):

"""
usage: sl vs reboot <identifier> [--hard | --soft] [options]

Expand Down Expand Up @@ -782,6 +797,7 @@ def execute(self, args):


class VSPowerOn(environment.CLIRunnable):

"""
usage: sl vs power-on <identifier> [options]

Expand All @@ -799,6 +815,7 @@ def execute(self, args):


class VSPause(environment.CLIRunnable):

"""
usage: sl vs pause <identifier> [options]

Expand All @@ -823,6 +840,7 @@ def execute(self, args):


class VSResume(environment.CLIRunnable):

"""
usage: sl vs resume <identifier> [options]

Expand All @@ -840,6 +858,7 @@ def execute(self, args):


class NicEditVS(environment.CLIRunnable):

"""
usage: sl vs nic-edit <identifier> (public | private) --speed=SPEED [options]

Expand All @@ -863,6 +882,7 @@ def execute(self, args):


class VSDNS(environment.CLIRunnable):

"""
usage: sl vs dns sync <identifier> [options]

Expand Down Expand Up @@ -971,6 +991,7 @@ def sync_ptr_record():


class EditVS(environment.CLIRunnable):

"""
usage: sl vs edit <identifier> [options]

Expand Down Expand Up @@ -1016,6 +1037,7 @@ def execute(self, args):


class CaptureVS(environment.CLIRunnable):

"""
usage: sl vs capture <identifier> [options]

Expand Down Expand Up @@ -1061,6 +1083,7 @@ def execute(self, args):


class UpgradeVS(environment.CLIRunnable):

"""
usage: sl vs upgrade <identifier> [options]

Expand Down
2 changes: 2 additions & 0 deletions SoftLayer/managers/hardware.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def list_hardware(self, tags=None, cpus=None, memory=None, hostname=None,
'primaryBackendIpAddress',
'primaryIpAddress',
'datacenter',
'billingItem.orderItem.order.userRecord[username]',
]
server_items = [
'activeTransaction[id, transactionStatus[friendlyName,name]]',
Expand Down Expand Up @@ -291,6 +292,7 @@ def get_hardware(self, hardware_id, **kwargs):
'hourlyBillingFlag',
'tagReferences[id,tag[name,id]]',
'networkVlans[id,vlanNumber,networkSpace]',
'billingItem.orderItem.order.userRecord[username]',
]
kwargs['mask'] = "mask[%s]" % ','.join(items)

Expand Down
2 changes: 2 additions & 0 deletions SoftLayer/managers/vs.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def list_instances(self, hourly=True, monthly=True, tags=None, cpus=None,
'datacenter',
'activeTransaction.transactionStatus[friendlyName,name]',
'status',
'billingItem.orderItem.order.userRecord[username]'
]
kwargs['mask'] = "mask[%s]" % ','.join(items)

Expand Down Expand Up @@ -199,6 +200,7 @@ def get_instance(self, instance_id, **kwargs):
'billingItem.recurringFee',
'tagReferences[id,tag[name,id]]',
'networkVlans[id,vlanNumber,networkSpace]',
'billingItem.orderItem.order.userRecord[username]'
]
kwargs['mask'] = "mask[%s]" % ','.join(items)

Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /