Replace pass with NotImplementedError in method stubs
[osm/N2VC.git] / juju / machine.py
1 import logging
2
3 from . import model
4 from .client import client
5
6 log = logging.getLogger(__name__)
7
8
9 class Machine(model.ModelEntity):
10 async def destroy(self, force=False):
11 """Remove this machine from the model.
12
13 Blocks until the machine is actually removed.
14
15 """
16 facade = client.ClientFacade()
17 facade.connect(self.connection)
18
19 log.debug(
20 'Destroying machine %s', self.id)
21
22 await facade.DestroyMachines(force, [self.id])
23 return await self.model._wait(
24 'machine', self.id, 'remove')
25 remove = destroy
26
27 def run(self, command, timeout=None):
28 """Run command on this machine.
29
30 :param str command: The command to run
31 :param int timeout: Time to wait before command is considered failed
32
33 """
34 raise NotImplementedError()
35
36 async def set_annotations(self, annotations):
37 """Set annotations on this machine.
38
39 :param annotations map[string]string: the annotations as key/value
40 pairs.
41
42 """
43 log.debug('Updating annotations on machine %s', self.id)
44
45 self.ann_facade = client.AnnotationsFacade()
46 self.ann_facade.connect(self.connection)
47
48 ann = client.EntityAnnotations(
49 entity=self.id,
50 annotations=annotations,
51 )
52 return await self.ann_facade.Set([ann])
53
54 def scp(
55 self, source_path, user=None, destination_path=None, proxy=False,
56 scp_opts=None):
57 """Transfer files to this machine.
58
59 :param str source_path: Path of file(s) to transfer
60 :param str user: Remote username
61 :param str destination_path: Destination of transferred files on
62 remote machine
63 :param bool proxy: Proxy through the Juju API server
64 :param str scp_opts: Additional options to the `scp` command
65
66 """
67 raise NotImplementedError()
68
69 def ssh(
70 self, command, user=None, proxy=False, ssh_opts=None):
71 """Execute a command over SSH on this machine.
72
73 :param str command: Command to execute
74 :param str user: Remote username
75 :param bool proxy: Proxy through the Juju API server
76 :param str ssh_opts: Additional options to the `ssh` command
77
78 """
79 raise NotImplementedError()
80
81 def status_history(self, num=20, utc=False):
82 """Get status history for this machine.
83
84 :param int num: Size of history backlog
85 :param bool utc: Display time as UTC in RFC3339 format
86
87 """
88 raise NotImplementedError()