Lines Matching refs:self

43     def __init__(self, env: Env, with_ssl=False):  argument
44 self.env = env
45 self._cmd = env.vsftpd
46 self._scheme = 'ftp'
47 self._with_ssl = with_ssl
48 if self._with_ssl:
49 self._port = self.env.ftps_port
52 self._port = self.env.ftp_port
54 self._vsftpd_dir = os.path.join(env.gen_dir, name)
55 self._run_dir = os.path.join(self._vsftpd_dir, 'run')
56 self._docs_dir = os.path.join(self._vsftpd_dir, 'docs')
57 self._tmp_dir = os.path.join(self._vsftpd_dir, 'tmp')
58 self._conf_file = os.path.join(self._vsftpd_dir, 'test.conf')
59 self._pid_file = os.path.join(self._vsftpd_dir, 'vsftpd.pid')
60 self._error_log = os.path.join(self._vsftpd_dir, 'vsftpd.log')
61 self._process = None
63 self.clear_logs()
66 def domain(self): argument
67 return self.env.ftp_domain
70 def docs_dir(self): argument
71 return self._docs_dir
74 def port(self) -> int: argument
75 return self._port
77 def clear_logs(self): argument
78 self._rmf(self._error_log)
80 def exists(self): argument
81 return os.path.exists(self._cmd)
83 def is_running(self): argument
84 if self._process:
85 self._process.poll()
86 return self._process.returncode is None
89 def start_if_needed(self): argument
90 if not self.is_running():
91 return self.start()
94 def stop_if_running(self): argument
95 if self.is_running():
96 return self.stop()
99 def stop(self, wait_dead=True): argument
100 self._mkpath(self._tmp_dir)
101 if self._process:
102 self._process.terminate()
103 self._process.wait(timeout=2)
104 self._process = None
105 return not wait_dead or self.wait_dead(timeout=timedelta(seconds=5))
108 def restart(self): argument
109 self.stop()
110 return self.start()
112 def start(self, wait_live=True): argument
113 self._mkpath(self._tmp_dir)
114 if self._process:
115 self.stop()
116 self._write_config()
118 self._cmd,
121 procerr = open(self._error_log, 'a')
122 self._process = subprocess.Popen(args=args, stderr=procerr)
123 if self._process.returncode is not None:
125 return not wait_live or self.wait_live(timeout=timedelta(seconds=5))
127 def wait_dead(self, timeout: timedelta): argument
128 curl = CurlClient(env=self.env, run_dir=self._tmp_dir)
140 def wait_live(self, timeout: timedelta): argument
141 curl = CurlClient(env=self.env, run_dir=self._tmp_dir)
155 def _rmf(self, path): argument
159 def _mkpath(self, path): argument
163 def _write_config(self): argument
164 self._mkpath(self._docs_dir)
165 self._mkpath(self._tmp_dir)
183 if self._with_ssl:
184 creds = self.env.get_credentials(self.domain)
196 with open(self._conf_file, 'w') as fd: