2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 Contrast to silent_script.py.
14 sys
.path
.insert(1, os
.path
.dirname(sys
.path
[0]))
16 # from mozharness.base.errors import TarErrorList, SSHErrorList
17 from mozharness
.base
.script
import BaseScript
21 class VerboseExample(BaseScript
):
22 def __init__(self
, require_config_file
=False):
23 super(VerboseExample
, self
).__init
__(
27 require_config_file
=require_config_file
,
28 config
={"tarball_name": "bar.tar.bz2"},
32 tarball_name
= self
.config
["tarball_name"]
34 "http://people.mozilla.org/~asasaki/foo.tar.bz2", file_name
=tarball_name
36 # the error_list adds more error checking.
37 # the halt_on_failure will kill the script at this point if
38 # unsuccessful. Be aware if you need to do any cleanup before you
39 # actually fatal(), though. If so, you may want to either use an
40 # |if self.run_command(...):| construct, or define a self._post_fatal()
41 # for a generic end-of-fatal-run method.
43 ["tar", "xjvf", tarball_name
],
44 # error_list=TarErrorList,
45 # halt_on_failure=True,
48 self
.rmtree("x/ship2")
49 self
.rmtree(tarball_name
)
51 ["tar", "cjvf", tarball_name
, "x"],
52 # error_list=TarErrorList,
53 # halt_on_failure=True,
58 ["scp", tarball_name
, "people.mozilla.org:public_html/foo2.tar.bz2"],
59 # error_list=SSHErrorList,
62 "There's been a problem with the scp. We're going to proceed anyway."
64 self
.rmtree(tarball_name
)
68 if __name__
== "__main__":
69 verbose_example
= VerboseExample()
70 verbose_example
.run_and_exit()