signature
stringlengths
8
3.44k
body
stringlengths
0
1.41M
docstring
stringlengths
1
122k
id
stringlengths
5
17
@asyncio.coroutine<EOL><INDENT>def connect(self):<DEDENT>
if time.time() < self._login_cooldown:<EOL><INDENT>raise FailedToConnect("<STR_LIT>")<EOL><DEDENT>resp = yield from self.session.post("<STR_LIT>", headers = {<EOL>"<STR_LIT:Content-Type>": "<STR_LIT:application/json>",<EOL>"<STR_LIT>": self.appid,<EOL>"<STR_LIT>": "<STR_LIT>" + self.token<EOL>}, data=json.dumps({"<STR_...
|coro| Connect to ubisoft, automatically called when needed
f10342:c5:m3
@asyncio.coroutine<EOL><INDENT>def get_players(self, name=None, platform=None, uid=None):<DEDENT>
if name is None and uid is None:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if name is not None and uid is not None:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if platform is None:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if "<STR_LIT>" not in self.cache: self.cache[platform] = {}<EOL>if...
|coro| get a list of players matching the term on that platform, exactly one of uid and name must be given, platform must be given, this list almost always has only 1 element, so it's easier to use get_player Parameters ---------- name : str the name of the ...
f10342:c5:m5
@asyncio.coroutine<EOL><INDENT>def get_player(self, name=None, platform=None, uid=None):<DEDENT>
results = yield from self.get_players(name=name, platform=platform, uid=uid)<EOL>return results[<NUM_LIT:0>]<EOL>
|coro| Calls get_players and returns the first element, exactly one of uid and name must be given, platform must be given Parameters ---------- name : str the name of the player you're searching for platform : str the name of the platform you're ...
f10342:c5:m6
@asyncio.coroutine<EOL><INDENT>def get_operator_definitions(self):<DEDENT>
if self._op_definitions is not None:<EOL><INDENT>return self._op_definitions<EOL><DEDENT>resp = yield from self.session.get("<STR_LIT>")<EOL>data = yield from resp.json()<EOL>self._op_definitions = data<EOL>return data<EOL>
|coro| Retrieves a list of information about operators - their badge, unique statistic, etc. Returns ------- dict operators
f10342:c5:m7
@asyncio.coroutine<EOL><INDENT>def get_operator_index(self, name):<DEDENT>
opdefs = yield from self.get_operator_definitions()<EOL>name = name.lower()<EOL>if name not in opdefs:<EOL><INDENT>return None<EOL><DEDENT>return opdefs[name]["<STR_LIT:index>"]<EOL>
|coro| Gets the operators index from the operator definitions dict Returns ------- str the operator index
f10342:c5:m8
@asyncio.coroutine<EOL><INDENT>def get_operator_statistic(self, name):<DEDENT>
opdefs = yield from self.get_operator_definitions()<EOL>name = name.lower()<EOL>if name not in opdefs:<EOL><INDENT>return None<EOL><DEDENT>if "<STR_LIT>" not in opdefs[name] or "<STR_LIT>" not in opdefs[name]["<STR_LIT>"]:<EOL><INDENT>return None<EOL><DEDENT>return opdefs[name]["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EO...
|coro| Gets the operator unique statistic from the operator definitions dict Returns ------- str the name of the operator unique statistic
f10342:c5:m9
@asyncio.coroutine<EOL><INDENT>def get_operator_badge(self, name):<DEDENT>
opdefs = yield from self.get_operator_definitions()<EOL>name = name.lower()<EOL>if name not in opdefs:<EOL><INDENT>return None<EOL><DEDENT>badge = opdefs[name]["<STR_LIT>"]<EOL>if not badge.startswith("<STR_LIT:http>"):<EOL><INDENT>badge = "<STR_LIT>" + badge<EOL><DEDENT>return badge<EOL>
|coro| Gets the operator badge URL Returns ------- str the operators badge URL
f10342:c5:m10
@asyncio.coroutine<EOL><INDENT>def get_definitions(self):<DEDENT>
if self._definitions is not None:<EOL><INDENT>return self._definitions<EOL><DEDENT>resp = yield from self.session.get("<STR_LIT>")<EOL>data = yield from resp.json()<EOL>self._definitions = data<EOL>return data<EOL>
|coro| Retrieves the list of api definitions, downloading it from Ubisoft if it hasn't been fetched all ready Primarily for internal use, but could contain useful information. Returns ------- dict definitions
f10342:c5:m11
@asyncio.coroutine<EOL><INDENT>def get_object_index(self, key):<DEDENT>
defns = yield from self.get_definitions()<EOL>for x in defns:<EOL><INDENT>if key in x and "<STR_LIT>" in defns[x]:<EOL><INDENT>return defns[x]["<STR_LIT>"]<EOL><DEDENT><DEDENT>return None<EOL>
|coro| Mainly for internal use with get_operator, returns the "location" index for the key in the definitions Returns ------- str the object's location index
f10342:c5:m12
def get_icon_url(self):
return self.RANK_ICONS[self.rank_id]<EOL>
Get URL for this rank's icon Returns ------- :class:`str` the URL for the rank icon
f10342:c6:m3
def get_charm_url(self):
if self.rank_id <= <NUM_LIT:4>: return self.RANK_CHARMS[<NUM_LIT:0>]<EOL>if self.rank_id <= <NUM_LIT:8>: return self.RANK_CHARMS[<NUM_LIT:1>]<EOL>if self.rank_id <= <NUM_LIT:12>: return self.RANK_CHARMS[<NUM_LIT:2>]<EOL>if self.rank_id <= <NUM_LIT:16>: return self.RANK_CHARMS[<NUM_LIT:3>]<EOL>if self.rank_id <= <NUM_LI...
Get charm URL for the bracket this rank is in Returns ------- :class:`str` the URL for the charm
f10342:c6:m4
def get_bracket(self):
return Rank.bracket_from_rank(self.rank_id)<EOL>
Get rank bracket Returns ------- :class:`int` the id for the rank bracket this rank is in
f10342:c6:m5
@asyncio.coroutine<EOL><INDENT>def load_level(self):<DEDENT>
data = yield from self.auth.get("<STR_LIT>" % (self.spaceid, self.platform_url, self.id))<EOL>if "<STR_LIT>" in data and len(data["<STR_LIT>"]) > <NUM_LIT:0>:<EOL><INDENT>self.xp = data["<STR_LIT>"][<NUM_LIT:0>].get("<STR_LIT>", <NUM_LIT:0>)<EOL>self.level = data["<STR_LIT>"][<NUM_LIT:0>].get("<STR_LIT>", <NUM_LIT:0>)<...
|coro| Load the players XP and level
f10342:c11:m3
@asyncio.coroutine<EOL><INDENT>def check_level(self):<DEDENT>
if not hasattr(self, "<STR_LIT>"):<EOL><INDENT>yield from self.load_level()<EOL><DEDENT>
|coro| Check the players XP and level, only loading it if it hasn't been loaded yet
f10342:c11:m4
@asyncio.coroutine<EOL><INDENT>def load_rank(self, region, season=-<NUM_LIT:1>):<DEDENT>
data = yield from self.auth.get("<STR_LIT>" % (self.spaceid, self.platform_url, self.id, region, season))<EOL>if "<STR_LIT>" in data and self.id in data["<STR_LIT>"]:<EOL><INDENT>regionkey = "<STR_LIT>" % (region, season)<EOL>self.ranks[regionkey] = Rank(data["<STR_LIT>"][self.id])<EOL>return self.ranks[regionkey]<EOL>...
|coro| Loads the players rank for this region and season Parameters ---------- region : str the name of the region you want to get the rank for season : Optional[int] the season you want to get the rank for (defaults to -1, latest season) Returns...
f10342:c11:m5
@asyncio.coroutine<EOL><INDENT>def get_rank(self, region, season=-<NUM_LIT:1>):<DEDENT>
cache_key = "<STR_LIT>" % (region, season)<EOL>if cache_key in self.ranks:<EOL><INDENT>return self.ranks[cache_key]<EOL><DEDENT>result = yield from self.load_rank(region, season)<EOL>return result<EOL>
|coro| Checks the players rank for this region, only loading it if it hasn't already been found Parameters ---------- region : str the name of the region you want to get the rank for season : Optional[int] the season you want to get the rank for (default...
f10342:c11:m6
@asyncio.coroutine<EOL><INDENT>def load_all_operators(self):<DEDENT>
statistics = "<STR_LIT>"<EOL>for operator in OperatorStatisticNames:<EOL><INDENT>operator_key = yield from self.auth.get_operator_statistic(operator)<EOL>if operator_key:<EOL><INDENT>statistics += "<STR_LIT:U+002C>" + operator_key<EOL><DEDENT><DEDENT>data = yield from self.auth.get("<STR_LIT>" % (self.spaceid, self.pla...
|coro| Loads the player stats for all operators Returns ------- dict[:class:`Operator`] the dictionary of all operators found
f10342:c11:m7
@asyncio.coroutine<EOL><INDENT>def get_all_operators(self):<DEDENT>
if len(self.operators) >= len(OperatorStatisticNames):<EOL><INDENT>return self.operators<EOL><DEDENT>result = yield from self.load_all_operators()<EOL>return result<EOL>
|coro| Checks the player stats for all operators, loading them all again if any aren't found This is significantly more efficient than calling get_operator for every operator name. Returns ------- dict[:class:`Operator`] the dictionary of all operators found
f10342:c11:m8
@asyncio.coroutine<EOL><INDENT>def load_operator(self, operator):<DEDENT>
location = yield from self.auth.get_operator_index(operator)<EOL>if location is None:<EOL><INDENT>raise ValueError("<STR_LIT>" % operator)<EOL><DEDENT>operator_key = yield from self.auth.get_operator_statistic(operator)<EOL>if operator_key is not None:<EOL><INDENT>operator_key = "<STR_LIT:U+002C>" + operator_key<EOL><D...
|coro| Loads the players stats for the operator Parameters ---------- operator : str the name of the operator Returns ------- :class:`Operator` the operator object found
f10342:c11:m9
@asyncio.coroutine<EOL><INDENT>def get_operator(self, operator):<DEDENT>
if operator in self.operators:<EOL><INDENT>return self.operators[operator]<EOL><DEDENT>result = yield from self.load_operator(operator)<EOL>return result<EOL>
|coro| Checks the players stats for this operator, only loading them if they haven't already been found Parameters ---------- operator : str the name of the operator Returns ------- :class:`Operator` the operator object found
f10342:c11:m10
@asyncio.coroutine<EOL><INDENT>def load_weapons(self):<DEDENT>
data = yield from self.auth.get("<STR_LIT>" % (self.spaceid, self.platform_url, self.id))<EOL>if not "<STR_LIT>" in data or not self.id in data["<STR_LIT>"]:<EOL><INDENT>raise InvalidRequest("<STR_LIT>" % str(data))<EOL><DEDENT>data = data["<STR_LIT>"][self.id]<EOL>self.weapons = [Weapon(i) for i in range(<NUM_LIT:7>)]...
|coro| Load the players weapon stats Returns ------- list[:class:`Weapon`] list of all the weapon objects found
f10342:c11:m11
@asyncio.coroutine<EOL><INDENT>def check_weapons(self):<DEDENT>
if len(self.weapons) == <NUM_LIT:0>:<EOL><INDENT>yield from self.load_weapons()<EOL><DEDENT>return self.weapons<EOL>
|coro| Check the players weapon stats, only loading them if they haven't already been found Returns ------- list[:class:`Weapon`] list of all the weapon objects found
f10342:c11:m12
@asyncio.coroutine<EOL><INDENT>def load_gamemodes(self):<DEDENT>
stats = yield from self._fetch_statistics("<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>")<EOL>self.gamemodes = {x: Gamemode(x) ...
|coro| Loads the players gamemode stats Returns ------- dict dict of all the gamemodes found (gamemode_name: :class:`Gamemode`)
f10342:c11:m13
@asyncio.coroutine<EOL><INDENT>def check_gamemodes(self):<DEDENT>
if len(self.gamemodes) == <NUM_LIT:0>:<EOL><INDENT>yield from self.load_gamemodes()<EOL><DEDENT>return self.gamemodes<EOL>
|coro| Checks the players gamemode stats, only loading them if they haven't already been found Returns ------- dict dict of all the gamemodes found (gamemode_name: :class:`Gamemode`)
f10342:c11:m14
@asyncio.coroutine<EOL><INDENT>def load_general(self):<DEDENT>
stats = yield from self._fetch_statistics("<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_L...
|coro| Loads the players general stats
f10342:c11:m15
@asyncio.coroutine<EOL><INDENT>def check_general(self):<DEDENT>
if not hasattr(self, "<STR_LIT>"):<EOL><INDENT>yield from self.load_general()<EOL><DEDENT>
|coro| Checks the players general stats, only loading them if they haven't already been found
f10342:c11:m16
@asyncio.coroutine<EOL><INDENT>def load_queues(self):<DEDENT>
stats = yield from self._fetch_statistics("<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>")<EOL>self.ranked = GameQueue("<STR_LIT>")<EOL>self.casual = GameQueue("<STR_LIT>")<EOL>for gq in (self.ranked, ...
|coro| Loads the players game queues
f10342:c11:m17
@asyncio.coroutine<EOL><INDENT>def check_queues(self):<DEDENT>
if self.casual is None:<EOL><INDENT>yield from self.load_queues()<EOL><DEDENT>
|coro| Checks the players game queues, only loading them if they haven't already been found
f10342:c11:m18
@asyncio.coroutine<EOL><INDENT>def load_terrohunt(self):<DEDENT>
stats = yield from self._fetch_statistics("<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_L...
|coro| Loads the player's general stats for terrorist hunt
f10342:c11:m19
@asyncio.coroutine<EOL><INDENT>def check_terrohunt(self):<DEDENT>
if self.terrorist_hunt is None:<EOL><INDENT>yield from self.load_terrohunt()<EOL><DEDENT>return self.terrorist_hunt<EOL>
|coro| Checks the players general stats for terrorist hunt, only loading them if they haven't been loaded already
f10342:c11:m20
def create_skeleton(shutit):
skel_path = shutit.cfg['<STR_LIT>']['<STR_LIT:path>']<EOL>skel_module_name = shutit.cfg['<STR_LIT>']['<STR_LIT>']<EOL>skel_domain = shutit.cfg['<STR_LIT>']['<STR_LIT>']<EOL>skel_domain_hash = shutit.cfg['<STR_LIT>']['<STR_LIT>']<EOL>skel_depends = shutit.cfg['<STR_LIT>']['<STR_LIT>']<EOL>skel_shutitfile...
Creates module based on a pattern supplied as a git repo.
f10345:m0
def shutit_method_scope(func):
def wrapper(self, shutit):<EOL><INDENT>"""<STR_LIT>"""<EOL>ret = func(self, shutit)<EOL>return ret<EOL><DEDENT>return wrapper<EOL>
Notifies the ShutIt object whenever we call a shutit module method. This allows setting values for the 'scope' of a function.
f10346:m0
def __new__(mcs, name, bases, local):
<EOL>if name != '<STR_LIT>':<EOL><INDENT>sim = mcs.ShutItModule<EOL>assert sim is not None, shutit_util.print_debug()<EOL>for fname, method in iteritems(local):<EOL><INDENT>if not hasattr(sim, fname):<EOL><INDENT>continue<EOL><DEDENT>if not callable(method):<EOL><INDENT>continue<EOL><DEDENT>sim_method = getattr(sim, fn...
Checks this is a ShutItModule, and wraps any ShutItModule methods that have been overridden in the subclass.
f10346:c3:m0
def __init__(self, module_id, run_order, description='<STR_LIT>', maintainer='<STR_LIT>', depends=None, conflicts=None, delivery_methods=None):
<EOL>self.module_id = module_id<EOL>if not isinstance(module_id, str): <EOL><INDENT>err = str(module_id) + '<STR_LIT>'<EOL>shutit_global.shutit_global_object.shutit_print(err)<EOL>raise ShutItModuleError(err)<EOL><DEDENT>if isinstance(run_order, (float, int, str)):<EOL><INDENT>run_order = decimal.Decimal(run_order)<EOL...
Constructor. Sets up module_id, run_order, deps and conflicts. Also checks types for safety.
f10346:c4:m0
def get_config(self, shutit):
return True<EOL>
Gets all config items necessary for this module to be built
f10346:c4:m1
def check_ready(self, shutit):
return True<EOL>
Checks whether we are ready to build this module. This is called before the build, to ensure modules have their requirements in place before we commence the build. Checking whether the build will happen at all (and therefore whether the check should take place) will be determine...
f10346:c4:m2
def remove(self, shutit):
return False<EOL>
Remove the module, which should ensure the module has been deleted from the system. Returns True if all removed without any errors, else False.
f10346:c4:m3
def start(self, shutit):
return True<EOL>
Run when module should be installed (is_installed() or configured to build is true) Run after repository work. Returns True if all started ok.
f10346:c4:m4
def stop(self, shutit):
return True<EOL>
Runs when module should be stopped. Runs before repo work, and before finalize is called. Returns True if all stopped ok.
f10346:c4:m5
def is_installed(self, shutit):
return shutit.is_shutit_installed(self.module_id)<EOL>
Determines whether the module has been built in this target host already. Returns True if it is certain it's there, else False. Required.
f10346:c4:m6
@abstractmethod<EOL><INDENT>def build(self, shutit):<DEDENT>
pass<EOL>
Runs the build part of the module, which should ensure the module has been set up. If is_installed determines that the module is already there, this is not run. Returns True if it has succeeded in building, else False. Required.
f10346:c4:m7
def finalize(self, shutit):
return True<EOL>
Finalize the module, ie do things that need doing after final module has been run and before we exit, eg updatedb.
f10346:c4:m9
def do_finalize():
def _finalize(shutit):<EOL><INDENT>shutit.stop_all()<EOL>shutit.log('<STR_LIT>' + str(shutit), level=logging.DEBUG)<EOL>for module_id in shutit.module_ids(rev=True):<EOL><INDENT>if shutit.is_installed(shutit.shutit_map[module_id]):<EOL><INDENT>shutit.login(prompt_prefix=module_id,command=shutit_global.shutit_global_obj...
Runs finalize phase; run after all builds are complete and all modules have been stopped.
f10347:m2
def check_dependee_order(depender, dependee, dependee_id):
<EOL>shutit_global.shutit_global_object.yield_to_draw()<EOL>if dependee.run_order > depender.run_order:<EOL><INDENT>return '<STR_LIT>' + depender.module_id + '<STR_LIT>' + str(depender.run_order) + '<STR_LIT>' + '<STR_LIT>' + dependee_id + '<STR_LIT>' + str(dependee.run_order) + '<STR_LIT>' + '<STR_LIT>'<EOL><DEDENT>re...
Checks whether run orders are in the appropriate order.
f10347:m3
def make_dep_graph(depender):
shutit_global.shutit_global_object.yield_to_draw()<EOL>digraph = '<STR_LIT>'<EOL>for dependee_id in depender.depends_on:<EOL><INDENT>digraph = (digraph + '<STR_LIT:">' + depender.module_id + '<STR_LIT>' + dependee_id + '<STR_LIT>')<EOL><DEDENT>return digraph<EOL>
Returns a digraph string fragment based on the passed-in module
f10347:m4
def get_config_set(self, section, option):
values = set()<EOL>for cp, filename, fp in self.layers:<EOL><INDENT>filename = filename <EOL>fp = fp <EOL>if cp.has_option(section, option):<EOL><INDENT>values.add(cp.get(section, option))<EOL><DEDENT><DEDENT>return values<EOL>
Returns a set with each value per config file in it.
f10347:c0:m4
def reload(self):
oldlayers = self.layers<EOL>self.layers = []<EOL>for cp, filename, fp in oldlayers:<EOL><INDENT>cp = cp <EOL>if fp is None:<EOL><INDENT>self.read(filename)<EOL><DEDENT>else:<EOL><INDENT>self.readfp(fp, filename)<EOL><DEDENT><DEDENT>
Re-reads all layers again. In theory this should overwrite all the old values with any newer ones. It assumes we never delete a config item before reload.
f10347:c0:m5
def __init__(self,<EOL>session_type,<EOL>standalone):
self.standalone = standalone<EOL>self.build = {}<EOL>self.build['<STR_LIT>'] = '<STR_LIT>'<EOL>self.build['<STR_LIT>'] = False<EOL>self.build['<STR_LIT>'] = '<STR_LIT>'<EOL>self.build['<STR_LIT>'] = []<EOL>self.build['<STR_LIT>'] ...
Constructor. Sets up: - shutit_modules - representation of loaded shutit modules - shutit_main_dir - directory in which shutit is located - cfg - dictionary of configuration of build ...
f10347:c2:m0
def get_shutit_pexpect_session_environment(self, environment_id):
if not isinstance(environment_id, str):<EOL><INDENT>self.fail('<STR_LIT>') <EOL><DEDENT>for env in shutit_global.shutit_global_object.shutit_pexpect_session_environments:<EOL><INDENT>if env.environment_id == environment_id:<EOL><INDENT>return env<EOL><DEDENT><DEDENT>return None<EOL>
Returns the first shutit_pexpect_session object related to the given environment-id
f10347:c2:m3
def get_current_shutit_pexpect_session_environment(self, note=None):
self.handle_note(note)<EOL>current_session = self.get_current_shutit_pexpect_session()<EOL>if current_session is not None:<EOL><INDENT>res = current_session.current_environment<EOL><DEDENT>else:<EOL><INDENT>res = None<EOL><DEDENT>self.handle_note_after(note)<EOL>return res<EOL>
Returns the current environment from the currently-set default pexpect child.
f10347:c2:m4
def get_current_shutit_pexpect_session(self, note=None):
self.handle_note(note)<EOL>res = self.current_shutit_pexpect_session<EOL>self.handle_note_after(note)<EOL>return res<EOL>
Returns the currently-set default pexpect child. @return: default shutit pexpect child object
f10347:c2:m5
def get_shutit_pexpect_sessions(self, note=None):
self.handle_note(note)<EOL>sessions = []<EOL>for key in self.shutit_pexpect_sessions:<EOL><INDENT>sessions.append(shutit_object.shutit_pexpect_sessions[key])<EOL><DEDENT>self.handle_note_after(note)<EOL>return sessions<EOL>
Returns all the shutit_pexpect_session keys for this object. @return: list of all shutit_pexpect_session keys (pexpect_session_ids)
f10347:c2:m6
def get_default_shutit_pexpect_session_expect(self):
return self.current_shutit_pexpect_session.default_expect<EOL>
Returns the currently-set default pexpect string (usually a prompt). @return: default pexpect string
f10347:c2:m7
def get_default_shutit_pexpect_session_check_exit(self):
return self.current_shutit_pexpect_session.check_exit<EOL>
Returns default value of check_exit. See send method. @rtype: boolean @return: Default check_exit value
f10347:c2:m8
def set_default_shutit_pexpect_session(self, shutit_pexpect_session):
assert isinstance(shutit_pexpect_session, ShutItPexpectSession), shutit_util.print_debug()<EOL>self.current_shutit_pexpect_session = shutit_pexpect_session<EOL>return True<EOL>
Sets the default pexpect child. @param shutit_pexpect_session: pexpect child to set as default
f10347:c2:m9
def set_default_shutit_pexpect_session_expect(self, expect=None):
if expect is None:<EOL><INDENT>self.current_shutit_pexpect_session.default_expect = self.expect_prompts['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>self.current_shutit_pexpect_session.default_expect = expect<EOL><DEDENT>return True<EOL>
Sets the default pexpect string (usually a prompt). Defaults to the configured root prompt if no argument is passed. @param expect: String to expect in the output @type expect: string
f10347:c2:m10
def fail(self, msg, shutit_pexpect_child=None, throw_exception=False):
shutit_global.shutit_global_object.yield_to_draw()<EOL>if shutit_pexpect_child is not None:<EOL><INDENT>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>shutit_util.print_debug(sys.exc_info())<EOL>shutit_pexpect_session.pause_point('<STR_LIT>' + msg, color='<STR_LIT>')<EOL><...
Handles a failure, pausing if a pexpect child object is passed in. @param shutit_pexpect_child: pexpect child to work on @param throw_exception: Whether to throw an exception. @type throw_exception: boolean
f10347:c2:m11
def get_current_environment(self, note=None):
shutit_global.shutit_global_object.yield_to_draw()<EOL>self.handle_note(note)<EOL>res = self.get_current_shutit_pexpect_session_environment().environment_id<EOL>self.handle_note_after(note)<EOL>return res<EOL>
Returns the current environment id from the current shutit_pexpect_session
f10347:c2:m12
def multisend(self,<EOL>send,<EOL>send_dict,<EOL>expect=None,<EOL>shutit_pexpect_child=None,<EOL>timeout=shutit_global.shutit_global_object.default_timeout,<EOL>check_exit=None,<EOL>fail_on_empty_before=True,<EOL>record_command=True,<EOL>exit_values=None,<EOL>escape=False,<EOL>echo=None,<EOL>note=None,<EOL>secret=False...
shutit_global.shutit_global_object.yield_to_draw()<EOL>assert isinstance(send_dict, dict), shutit_util.print_debug()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>expect = expect or self.get_current_shutit_pexpect_session().default_expect<EOL>shutit_pexpe...
Multisend. Same as send, except it takes multiple sends and expects in a dict that are processed while waiting for the end "expect" argument supplied. @param send_dict: see shutit_sendspec @param expect: String or list of strings of final expected output that returns fr...
f10347:c2:m13
def send_and_require(self,<EOL>send,<EOL>regexps,<EOL>not_there=False,<EOL>shutit_pexpect_child=None,<EOL>echo=None,<EOL>note=None,<EOL>loglevel=logging.INFO):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.send_and_require(send,<EOL>regexps...
Send string and require the item in the output. See send_until
f10347:c2:m14
def send_until(self,<EOL>send,<EOL>regexps,<EOL>not_there=False,<EOL>shutit_pexpect_child=None,<EOL>cadence=<NUM_LIT:5>,<EOL>retries=<NUM_LIT:100>,<EOL>echo=None,<EOL>note=None,<EOL>debug_command=None,<EOL>pause_point_on_fail=True,<EOL>nonewline=False,<EOL>loglevel=logging.INFO):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.send_until(send,<EOL>regexps,<EOL>...
Send string on a regular cadence until a string is either seen, or the timeout is triggered. @param send: See send() @param regexps: List of regexps to wait for. @param not_there: If True, wait until this a regexp is not seen in the output. If False ...
f10347:c2:m15
def challenge(self,<EOL>task_desc,<EOL>expect=None,<EOL>hints=None,<EOL>congratulations='<STR_LIT:OK>',<EOL>failed='<STR_LIT>',<EOL>expect_type='<STR_LIT>',<EOL>challenge_type='<STR_LIT>',<EOL>shutit_pexpect_child=None,<EOL>timeout=None,<EOL>check_exit=None,<EOL>fail_on_empty_before=True,<EOL>record_command=True,<EOL>e...
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.challenge(self,<EOL>task_desc=task...
Set the user a task to complete, success being determined by matching the output. Either pass in regexp(s) desired from the output as a string or a list, or an md5sum of the output wanted. @param follow_on_context On success, move to this context. A dict of information about that context. ...
f10347:c2:m16
def send(self,<EOL>send,<EOL>expect=None,<EOL>shutit_pexpect_child=None,<EOL>timeout=None,<EOL>check_exit=None,<EOL>fail_on_empty_before=True,<EOL>record_command=True,<EOL>exit_values=None,<EOL>echo=None,<EOL>escape=False,<EOL>retry=<NUM_LIT:3>,<EOL>note=None,<EOL>assume_gnu=True,<EOL>follow_on_commands=None,<EOL>searc...
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>ignore_background = not wait<EOL>return shutit_pexpect_session.s...
Send string as a shell command, and wait until the expected output is seen (either a string or any from a list of strings) before returning. The expected string will default to the currently-set default expected string (see get_default_shutit_pexpect_session_expect) Returns the pexpect ...
f10347:c2:m17
def send_and_return_status(self,<EOL>send,<EOL>expect=None,<EOL>shutit_pexpect_child=None,<EOL>timeout=None,<EOL>fail_on_empty_before=True,<EOL>record_command=True,<EOL>exit_values=None,<EOL>echo=None,<EOL>escape=False,<EOL>retry=<NUM_LIT:3>,<EOL>note=None,<EOL>assume_gnu=True,<EOL>follow_on_commands=None,<EOL>loglevel...
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>shutit_pexpect_session.send(ShutItSendSpec(shutit_pexpect_sessio...
Returns true if a good exit code was received (usually 0)
f10347:c2:m18
def handle_note(self, note, command='<STR_LIT>', training_input='<STR_LIT>'):
shutit_global.shutit_global_object.yield_to_draw()<EOL>if self.build['<STR_LIT>'] and note != None and note != '<STR_LIT>':<EOL><INDENT>assert isinstance(note, str), shutit_util.print_debug()<EOL>wait = self.build['<STR_LIT>']<EOL>wrap = '<STR_LIT:\n>' + <NUM_LIT>*'<STR_LIT:=>' + '<STR_LIT:\n>'<EOL>message = wrap + not...
Handle notes and walkthrough option. @param note: See send()
f10347:c2:m19
def expect_allow_interrupt(self,<EOL>shutit_pexpect_child,<EOL>expect,<EOL>timeout,<EOL>iteration_s=<NUM_LIT:1>):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>accum_timeout = <NUM_LIT:0><EOL>if isinstance(expect, str):<EOL><INDENT>expect = [expect]<EOL><DEDENT>if timeout < <NUM_LIT:1>:<EOL><INDENT>timeout = <NUM_LIT:1><EOL><DEDE...
This function allows you to interrupt the run at more or less any point by breaking up the timeout into interactive chunks.
f10347:c2:m21
def run_script(self,<EOL>script,<EOL>shutit_pexpect_child=None,<EOL>in_shell=True,<EOL>echo=None,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.run_script(script,<EOL>in_shell=in...
Run the passed-in string as a script on the target's command line. @param script: String representing the script. It will be de-indented and stripped before being run. @param shutit_pexpect_child: See send() @param in_shell: Indicate whether we are ...
f10347:c2:m22
def send_file(self,<EOL>path,<EOL>contents,<EOL>shutit_pexpect_child=None,<EOL>truncate=False,<EOL>note=None,<EOL>user=None,<EOL>echo=False,<EOL>group=None,<EOL>loglevel=logging.INFO,<EOL>encoding=None):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.send_file(path,<EOL>contents,<EOL>...
Sends the passed-in string as a file to the passed-in path on the target. @param path: Target location of file on target. @param contents: Contents of file as a string. @param shutit_pexpect_child: See send() @param note: See send() @param user: ...
f10347:c2:m23
def chdir(self,<EOL>path,<EOL>shutit_pexpect_child=None,<EOL>timeout=shutit_global.shutit_global_object.default_timeout,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.chdir(path,timeout=timeout,note=no...
How to change directory will depend on whether we are in delivery mode bash or docker. @param path: Path to send file to. @param shutit_pexpect_child: See send() @param timeout: Timeout on response @param note: See send()
f10347:c2:m24
def send_host_file(self,<EOL>path,<EOL>hostfilepath,<EOL>expect=None,<EOL>shutit_pexpect_child=None,<EOL>note=None,<EOL>user=None,<EOL>group=None,<EOL>loglevel=logging.INFO):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>expect = expect or self.get_current_shutit_pexpect_session().default_expect<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pex...
Send file from host machine to given path @param path: Path to send file to. @param hostfilepath: Path to file from host to send to target. @param expect: See send() @param shutit_pexpect_child: See send() @param note: See send() @param ...
f10347:c2:m25
def send_host_dir(self,<EOL>path,<EOL>hostfilepath,<EOL>expect=None,<EOL>shutit_pexpect_child=None,<EOL>note=None,<EOL>user=None,<EOL>group=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>expect = expect or self.get_current_shutit_pexpect_session().default_expect<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pex...
Send directory and all contents recursively from host machine to given path. It will automatically make directories on the target. @param path: Path to send directory to (places hostfilepath inside path as a subfolder) @param hostfilepath: Path to file from host to send to target ...
f10347:c2:m26
def file_exists(self,<EOL>filename,<EOL>shutit_pexpect_child=None,<EOL>directory=False,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.file_exists(filename=filename,dire...
Return True if file exists on the target host, else False @param filename: Filename to determine the existence of. @param shutit_pexpect_child: See send() @param directory: Indicate that the file is a directory. @param note: See send() @type filename: string ...
f10347:c2:m27
def get_file_perms(self,<EOL>filename,<EOL>shutit_pexpect_child=None,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.get_file_perms(filename,note=note,...
Returns the permissions of the file on the target as an octal string triplet. @param filename: Filename to get permissions of. @param shutit_pexpect_child: See send() @param note: See send() @type filename: string @rtype: string
f10347:c2:m28
def remove_line_from_file(self,<EOL>line,<EOL>filename,<EOL>shutit_pexpect_child=None,<EOL>match_regexp=None,<EOL>literal=False,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.remove_line_from_file(line,filenam...
Removes line from file, if it exists. Must be exactly the line passed in to match. Returns True if there were no problems, False if there were. @param line: Line to remove. @param filename Filename to remove it from. @param shutit_pexpect_child: See send()...
f10347:c2:m29
def change_text(self,<EOL>text,<EOL>fname,<EOL>pattern=None,<EOL>expect=None,<EOL>shutit_pexpect_child=None,<EOL>before=False,<EOL>force=False,<EOL>delete=False,<EOL>note=None,<EOL>replace=False,<EOL>line_oriented=True,<EOL>create=True,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>expect = expect or self.get_current_shutit_pexpect_session().default_expect<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pex...
Change text in a file. Returns None if there was no match for the regexp, True if it was matched and replaced, and False if the file did not exist or there was some other problem. @param text: Text to insert. @param fname: Filename to insert text to @pa...
f10347:c2:m30
def insert_text(self,<EOL>text,<EOL>fname,<EOL>pattern=None,<EOL>expect=None,<EOL>shutit_pexpect_child=None,<EOL>before=False,<EOL>force=False,<EOL>note=None,<EOL>replace=False,<EOL>line_oriented=True,<EOL>create=True,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>return self.change_text(text=text,<EOL>fname=fname,<EOL>pattern=pattern,<EOL>expect=expect,<EOL>shutit_pexpect_child=shutit_pexpect_child,<EOL>before=before,<EOL>force=force,<EOL>note=note,<EOL>line_oriented=line_oriented,<EOL>create=create,<EOL>replace=replace,<EO...
Insert a chunk of text at the end of a file, or after (or before) the first matching pattern in given file fname. See change_text
f10347:c2:m31
def delete_text(self,<EOL>text,<EOL>fname,<EOL>pattern=None,<EOL>expect=None,<EOL>shutit_pexpect_child=None,<EOL>note=None,<EOL>before=False,<EOL>force=False,<EOL>line_oriented=True,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>return self.change_text(text,<EOL>fname,<EOL>pattern,<EOL>expect,<EOL>shutit_pexpect_child,<EOL>before,<EOL>force,<EOL>note=note,<EOL>delete=True,<EOL>line_oriented=line_oriented,<EOL>loglevel=loglevel)<EOL>
Delete a chunk of text from a file. See insert_text.
f10347:c2:m32
def replace_text(self,<EOL>text,<EOL>fname,<EOL>pattern=None,<EOL>expect=None,<EOL>shutit_pexpect_child=None,<EOL>note=None,<EOL>before=False,<EOL>force=False,<EOL>line_oriented=True,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>return self.change_text(text,<EOL>fname,<EOL>pattern,<EOL>expect,<EOL>shutit_pexpect_child,<EOL>before,<EOL>force,<EOL>note=note,<EOL>line_oriented=line_oriented,<EOL>replace=True,<EOL>loglevel=loglevel)<EOL>
Replace a chunk of text from a file. See insert_text.
f10347:c2:m33
def add_line_to_file(self, line, filename, expect=None, shutit_pexpect_child=None, match_regexp=None, loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>if isinstance(line, str):<EOL><INDENT>lines = [line]<EOL><DEDENT>elif isinstance(line, list):<EOL><INDENT>lines = line<EOL>match_regexp = None<EOL><DEDENT>fail = False<EOL>for fline in lines:<EOL><INDENT>if match_regexp is None:<EOL><INDENT>this_match_regexp = flin...
Deprecated. Use replace/insert_text instead. Adds line to file if it doesn't exist (unless Force is set, which it is not by default). Creates the file if it doesn't exist. Must be exactly the line passed in to match. Returns True if line(s) added OK, False if not. If yo...
f10347:c2:m34
def add_to_bashrc(self, line, shutit_pexpect_child=None, match_regexp=None, note=None, loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>shutit_pexpect_session.add_to_bashrc(line,match_regexp=match_reg...
Takes care of adding a line to everyone's bashrc (/etc/bash.bashrc, /etc/profile). @param line: Line to add. @param shutit_pexpect_child: See send() @param match_regexp: See add_line_to_file() @param note: See send()
f10347:c2:m35
def get_url(self,<EOL>filename,<EOL>locations,<EOL>command='<STR_LIT>',<EOL>shutit_pexpect_child=None,<EOL>timeout=shutit_global.shutit_global_object.default_timeout,<EOL>fail_on_empty_before=True,<EOL>record_command=True,<EOL>exit_values=None,<EOL>retry=<NUM_LIT:3>,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.get_url(filename,<EOL>locations,<E...
Handles the getting of a url for you. Example: get_url('somejar.jar', ['ftp://loc.org','http://anotherloc.com/jars']) @param filename: name of the file to download @param locations: list of URLs whence the file can be downloaded @param command: ...
f10347:c2:m36
def user_exists(self,<EOL>user,<EOL>shutit_pexpect_child=None,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session(user,note=note,loglevel=loglevel)<...
Returns true if the specified username exists. @param user: username to check for @param shutit_pexpect_child: See send() @param note: See send() @type user: string @rtype: boolean
f10347:c2:m37
def package_installed(self,<EOL>package,<EOL>shutit_pexpect_child=None,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session(package,note=note,loglevel=loglevel)<EOL>
Returns True if we can be sure the package is installed. @param package: Package as a string, eg 'wget'. @param shutit_pexpect_child: See send() @param note: See send() @rtype: boolean
f10347:c2:m38
def is_shutit_installed(self,<EOL>module_id,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_session = self.get_current_shutit_pexpect_session()<EOL>return shutit_pexpect_session.is_shutit_installed(module_id,note=note,loglevel=loglevel)<EOL>
Helper proc to determine whether shutit has installed already here by placing a file in the db. @param module_id: Identifying string of shutit module @param note: See send()
f10347:c2:m40
def ls(self,<EOL>directory,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_session = self.get_current_shutit_pexpect_session()<EOL>return shutit_pexpect_session.is_shutit_installed(directory,note=note,loglevel=loglevel)<EOL>
Helper proc to list files in a directory @param directory: directory to list. If the directory doesn't exist, shutit.fail() is called (i.e. the build fails.) @param note: See send() @type directory: string @rtype: list of strings
f10347:c2:m41
def get_file(self,<EOL>target_path,<EOL>host_path,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>self.handle_note(note)<EOL>if self.build['<STR_LIT>'] != '<STR_LIT>':<EOL><INDENT>return False<EOL><DEDENT>shutit_pexpect_child = self.get_shutit_pexpect_session_from_id('<STR_LIT>').pexpect_child<EOL>expect = self.expect_prompts['<STR_LIT>']<EOL>self.send('...
Copy a file from the target machine to the host machine @param target_path: path to file in the target @param host_path: path to file on the host machine (e.g. copy test) @param note: See send() @type target_path: string @type host_path: string @return: ...
f10347:c2:m42
def prompt_cfg(self, msg, sec, name, ispass=False):
shutit_global.shutit_global_object.yield_to_draw()<EOL>cfgstr = '<STR_LIT>' % (sec, name)<EOL>config_parser = self.config_parser<EOL>usercfg = os.path.join(self.host['<STR_LIT>'], '<STR_LIT>')<EOL>self.log('<STR_LIT>' % (cfgstr,),transient=True,level=logging.INFO)<EOL>self.log('<STR_LIT:\n>' + msg + '<STR_...
Prompt for a config value, optionally saving it to the user-level cfg. Only runs if we are in an interactive mode. @param msg: Message to display to user. @param sec: Section of config to add to. @param name: Config item name. @param ispass: If True, hide the input from ...
f10347:c2:m43
def step_through(self, msg='<STR_LIT>', shutit_pexpect_child=None, level=<NUM_LIT:1>, print_input=True, value=True):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>if (not shutit_global.shutit_global_object.determine_interactive...
Implements a step-through function, using pause_point.
f10347:c2:m44
def interact(self,<EOL>msg='<STR_LIT>',<EOL>shutit_pexpect_child=None,<EOL>print_input=True,<EOL>level=<NUM_LIT:1>,<EOL>resize=True,<EOL>color='<STR_LIT>',<EOL>default_msg=None,<EOL>wait=-<NUM_LIT:1>):
shutit_global.shutit_global_object.yield_to_draw()<EOL>self.pause_point(msg=msg,<EOL>shutit_pexpect_child=shutit_pexpect_child,<EOL>print_input=print_input,<EOL>level=level,<EOL>resize=resize,<EOL>color=color,<EOL>default_msg=default_msg,<EOL>interact=True,<EOL>wait=wait)<EOL>
Same as pause_point, but sets up the terminal ready for unmediated interaction.
f10347:c2:m45
def pause_point(self,<EOL>msg='<STR_LIT>',<EOL>shutit_pexpect_child=None,<EOL>print_input=True,<EOL>level=<NUM_LIT:1>,<EOL>resize=True,<EOL>color='<STR_LIT>',<EOL>default_msg=None,<EOL>interact=False,<EOL>wait=-<NUM_LIT:1>):
shutit_global.shutit_global_object.yield_to_draw()<EOL>if (not shutit_global.shutit_global_object.determine_interactive() or shutit_global.shutit_global_object.interactive < <NUM_LIT:1> or<EOL>shutit_global.shutit_global_object.interactive < level):<EOL><INDENT>return True<EOL><DEDENT>shutit_pexpect_child = shutit_pexp...
Inserts a pause in the build session, which allows the user to try things out before continuing. Ignored if we are not in an interactive mode, or the interactive level is less than the passed-in one. Designed to help debug the build, or drop to on failure so the situation can be debugged...
f10347:c2:m46
def send_and_match_output(self,<EOL>send,<EOL>matches,<EOL>shutit_pexpect_child=None,<EOL>retry=<NUM_LIT:3>,<EOL>strip=True,<EOL>note=None,<EOL>echo=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.send_and_match_output(send,<EOL>ma...
Returns true if the output of the command matches any of the strings in the matches list of regexp strings. Handles matching on a per-line basis and does not cross lines. @param send: See send() @param matches: String - or list of strings - of regexp(s) to check @param shut...
f10347:c2:m47
def send_and_get_output(self,<EOL>send,<EOL>shutit_pexpect_child=None,<EOL>timeout=None,<EOL>retry=<NUM_LIT:3>,<EOL>strip=True,<EOL>preserve_newline=False,<EOL>note=None,<EOL>record_command=False,<EOL>echo=None,<EOL>fail_on_empty_before=True,<EOL>nonewline=False,<EOL>wait=False,<EOL>loglevel=logging.INFO):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>ignore_background = not wait<EOL>return shutit_pexpect_session.s...
Returns the output of a command run. send() is called, and exit is not checked. @param send: See send() @param shutit_pexpect_child: See send() @param retry: Number of times to retry command (default 3) @param strip: Whether to strip output (defaults to True). Strips whites...
f10347:c2:m48
def install(self,<EOL>package,<EOL>shutit_pexpect_child=None,<EOL>options=None,<EOL>timeout=shutit_global.shutit_global_object.default_timeout,<EOL>force=False,<EOL>check_exit=True,<EOL>echo=None,<EOL>reinstall=False,<EOL>background=False,<EOL>wait=False,<EOL>block_other_commands=True,<EOL>note=None,<EOL>loglevel=loggi...
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>ignore_background = not wait<EOL>return shutit_pexpect_session.i...
Distro-independent install function. Takes a package name and runs the relevant install function. @param package: Package to install, which is run through package_map @param shutit_pexpect_child: See send() @param timeout: Timeout (s) to wait for finish of install. Defaults t...
f10347:c2:m49
def remove(self,<EOL>package,<EOL>shutit_pexpect_child=None,<EOL>options=None,<EOL>echo=None,<EOL>timeout=shutit_global.shutit_global_object.default_timeout,<EOL>note=None):
shutit_global.shutit_global_object.yield_to_draw()<EOL>if package.find('<STR_LIT:U+0020>') != -<NUM_LIT:1>:<EOL><INDENT>for p in package.split('<STR_LIT:U+0020>'):<EOL><INDENT>self.install(p,shutit_pexpect_child=shutit_pexpect_child,options=options,timeout=timeout,note=note)<EOL><DEDENT><DEDENT>shutit_pexpect_child = s...
Distro-independent remove function. Takes a package name and runs relevant remove function. @param package: Package to remove, which is run through package_map. @param shutit_pexpect_child: See send() @param options: Dict of options to pass to the remove command, ...
f10347:c2:m50
def get_env_pass(self,<EOL>user=None,<EOL>msg=None,<EOL>shutit_pexpect_child=None,<EOL>note=None):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.get_env_pass(user=user,<EOL>msg=ms...
Gets a password from the user if one is not already recorded for this environment. @param user: username we are getting password for @param msg: message to put out there
f10347:c2:m51
def whoarewe(self,<EOL>shutit_pexpect_child=None,<EOL>note=None,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.whoarewe(note=note,<EOL>loglevel=l...
Returns the current group. @param shutit_pexpect_child: See send() @param note: See send() @return: the first group found @rtype: string
f10347:c2:m52
def login(self,<EOL>command='<STR_LIT>',<EOL>user=None,<EOL>password=None,<EOL>prompt_prefix=None,<EOL>expect=None,<EOL>timeout=shutit_global.shutit_global_object.default_timeout,<EOL>escape=False,<EOL>echo=None,<EOL>note=None,<EOL>go_home=True,<EOL>fail_on_fail=True,<EOL>is_ssh=True,<EOL>check_sudo=True,<EOL>loglevel=...
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_session = self.get_current_shutit_pexpect_session()<EOL>return shutit_pexpect_session.login(ShutItSendSpec(shutit_pexpect_session,<EOL>user=user,<EOL>send=command,<EOL>password=password,<EOL>prompt_prefix=prompt_prefix,<EOL>expect=expect,<EOL>timeout...
Logs user in on default child.
f10347:c2:m53
def logout_all(self,<EOL>command='<STR_LIT>',<EOL>note=None,<EOL>echo=None,<EOL>timeout=shutit_global.shutit_global_object.default_timeout,<EOL>nonewline=False,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>for key in self.shutit_pexpect_sessions:<EOL><INDENT>shutit_pexpect_session = self.shutit_pexpect_sessions[key]<EOL>shutit_pexpect_session.logout_all(ShutItSendSpec(shutit_pexpect_session,<EOL>send=command,<EOL>note=note,<EOL>timeout=timeout,<EOL>nonewline=nonewlin...
Logs the user out of all pexpect sessions within this ShutIt object. @param command: Command to run to log out (default=exit) @param note: See send()
f10347:c2:m54
def logout(self,<EOL>command='<STR_LIT>',<EOL>note=None,<EOL>echo=None,<EOL>timeout=shutit_global.shutit_global_object.default_timeout,<EOL>nonewline=False,<EOL>loglevel=logging.DEBUG):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_session = self.get_current_shutit_pexpect_session()<EOL>return shutit_pexpect_session.logout(ShutItSendSpec(shutit_pexpect_session,<EOL>send=command,<EOL>note=note,<EOL>timeout=timeout,<EOL>nonewline=nonewline,<EOL>loglevel=loglevel,<EOL>echo=echo))<...
Logs the user out. Assumes that login has been called. If login has never been called, throw an error. @param command: Command to run to log out (default=exit) @param note: See send()
f10347:c2:m55
def get_memory(self,<EOL>shutit_pexpect_child=None,<EOL>note=None):
shutit_global.shutit_global_object.yield_to_draw()<EOL>shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child<EOL>shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)<EOL>return shutit_pexpect_session.get_memory(note=note)<EOL>
Returns memory available for use in k as an int
f10347:c2:m57