~ubuntu-branches/ubuntu/vivid/python-softlayer/vivid

« back to all changes in this revision

Viewing changes to SoftLayer/managers/hardware.py

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2013-11-24 23:43:01 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20131124234301-9xqccxig339g04j5
Tags: 3.0.1-1
New upstream bugfix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
 
100
100
        """
101
101
        if 'mask' not in kwargs:
102
 
            items = set([
 
102
            hw_items = set([
103
103
                'id',
104
104
                'hostname',
105
105
                'domain',
112
112
                'primaryIpAddress',
113
113
                'datacenter',
114
114
            ])
115
 
            kwargs['mask'] = "mask[%s]" % ','.join(items)
 
115
            server_items = set([
 
116
                'activeTransaction[id, transactionStatus[friendlyName,name]]',
 
117
            ])
 
118
 
 
119
            kwargs['mask'] = '[mask[%s],' \
 
120
                             ' mask(SoftLayer_Hardware_Server)[%s]]' % \
 
121
                             (','.join(hw_items),
 
122
                              ','.join(server_items))
116
123
 
117
124
        _filter = NestedDict(kwargs.get('filter') or {})
118
125
        if tags:
256
263
                'networkComponents.primarySubnet[id, netmask,'
257
264
                'broadcastAddress, networkIdentifier, gateway]',
258
265
                'hardwareChassis[id,name]',
259
 
                'activeTransaction.id',
 
266
                'activeTransaction[id, transactionStatus[friendlyName,name]]',
260
267
                'operatingSystem.softwareLicense.'
261
268
                'softwareDescription[manufacturer,name,version,referenceCode]',
262
269
                'operatingSystem.passwords[username,password]',
269
276
 
270
277
        return self.hardware.getObject(id=id, **kwargs)
271
278
 
272
 
    def reload(self, id, post_uri=None):
 
279
    def reload(self, id, post_uri=None, ssh_keys=None):
273
280
        """ Perform an OS reload of a server with its current configuration.
274
281
 
275
282
        :param integer id: the instance ID to reload
276
283
        :param string post_url: The URI of the post-install script to run
277
284
                                after reload
278
 
 
 
285
        :param list ssh_keys: The SSH keys to add to the root user
279
286
        """
280
287
 
281
288
        payload = {
286
293
        if post_uri:
287
294
            payload['config']['customProvisionScriptUri'] = post_uri
288
295
 
 
296
        if ssh_keys:
 
297
            payload['config']['sshKeyIds'] = [key_id for key_id in ssh_keys]
 
298
 
289
299
        return self.hardware.reloadOperatingSystem('FORCE', payload['config'],
290
300
                                                   id=id)
291
301