def deploy(): """ update production environment :return: """ with cd('/opt/therapists'): sudo('git pull') run('pm2 restart all')
def action_create(self): if not self.user: command = ['useradd'] useradd_options = dict( comment = "-c", gid = "-g", uid = "-u", shell = "-s", password = "******", ) for option_name, option_value in self.resource.arguments.items(): option_flag = useradd_options.get(option_name) if option_flag: command += [option_flag, option_value] command.append(self.resource.username) fabric.sudo(command) self.resource.updated()
def user(self): with fabric.settings(fabric.hide('warnings','stdout','stderr', 'running'), warn_only=True): res=fabric.sudo('grep "^%s:" /etc/passwd' % self.resource.username) if res.failed: return None
def _cloudify_rpm_versions(self): with self._manager_fabric_env() as fabric: return fabric.sudo('rpm -qa | grep cloudify')