def value(self, value): if value is None: value = self.value_raw if isinstance(value, str): value = Chibi_image(value) self.value_raw = value.path self.mime = value.properties.mime self.extension = value.properties.extension self.file = value.file_name self.dir = value.dir self.album = os.path.split(self.dir)[-1] self.base_path = list(os.path.split(self.dir)) self.base_path.pop() self.base_path = join(*self.base_path) if self.thumbnail_dir: self.thumbnail_path = Chibi_path(self.thumbnail_dir) else: self.thumbnail_path = add_extensions(self.base_path, "thumbnail") self.thumbnail_path = self.thumbnail_path + self.album mkdir(self.thumbnail_path) thumbnail = value.thumbnail(self.thumbnail_path) self.thumbnail_path = thumbnail.path
'active_state', 'No')) try: response = requests.get(url) except: time.sleep(10) continue if (status == 'active' and str(response.status_code) == '200'): break time.sleep(10) print(status) print(response.status_code, response.text) print(requests.get(url).text) f = Chibi_file(join(FOLDER_PROVISION, "resource_event.template.json")) j = f.read_json() r = requests.put("{}/_template/turn_api__api_event".format(url), json=j, headers=headers) print(r.text) f = Chibi_file(join(FOLDER_PROVISION, "background_check.template.json")) j = f.read_json() r = requests.put("{}/_template/turn_api__background_checks".format(url), json=j, headers=headers) print(r.text) f = Chibi_file(join(FOLDER_PROVISION, "county.template.json")) j = f.read_json()
from chibi.command import yum, git, command from chibi.command.echo import cowsay from chibi.file import Chibi_file from chibi.file.snippets import inflate_dir, join, exists, current_dir, cd cache_dir = inflate_dir( '~/.cache' ) file_check_path = inflate_dir( '~/provision_installed' ) file_check = Chibi_file( file_check_path ) version_to_check = "ponysay\n".format( file=__file__, ) if __name__ == "__main__" and not version_to_check in file_check: cowsay( "Starting install for ponysay" ) yum.install( 'texinfo' ) original_dir = current_dir() cd( cache_dir ) ponysay_dir = join( cache_dir, 'ponysay' ) if not exists( ponysay_dir ): git.clone( 'https://github.com/erkin/ponysay.git', ponysay_dir ) cd( ponysay_dir ) command( 'python3', './setup.py', 'install', '--freedom=partial' ) cd( original_dir ) file_check.append( version_to_check )
#!/usr/bin/env python3 from chibi.command import systemctl from chibi.command.echo import cowsay from chibi.file.snippets import join, copy, chown FOLDER_PROVISION = "/home/vagrant/provision/elasticsearch/provision" if __name__ == "__main__": cowsay("config of elasticsearch") copy(join(FOLDER_PROVISION, 'elasticsearch.yml'), '/etc/elasticsearch/elasticsearch.yml') chown('/etc/elasticsearch/elasticsearch.yml', user_name='elasticsearch', group_name='elasticsearch') systemctl.restart('elasticsearch.service') cowsay("end config of elasticsearch")
'network.host': '${HOSTNAME}', 'network.bind_host': '${HOSTNAME}', 'discovery.zen.ping.unicast.hosts': masters, 'path.data': '/var/data/waifus', 'path.logs': '/var/log/waifus', } str_config = yaml.dump( config ) with open ( '/etc/elasticsearch/elasticsearch.yml', 'w' ) as file: file.write( str_config ) mkdir( '/var/data/waifus', verbose=True ) mkdir( '/var/log/waifus', verbose=True ) if not exists( '/etc/elasticsearch/synonyms' ): mkdir( '/etc/elasticsearch/synonyms', verbose=True ) synonyms_folder = join( FOLDER_PROVISION, 'synonyms' ) copy( join( synonyms_folder, '*.txt' ), '/etc/elasticsearch/synonyms/', verbose=True ) chown( '/var/data/waifus', '/var/log/waifus', '/etc/elasticsearch/synonyms', user_name='elasticsearch', group_name='elasticsearch' ) systemctl.restart( 'elasticsearch.service' ) cowsay( "termino de actualizar la configuracion de elasticsearch" )
#!/usr/bin/env python3 from chibi.command import yum, git, command from chibi.command.echo import cowsay from chibi.file import Chibi_file from chibi.file.snippets import inflate_dir, join, exists, current_dir, cd cache_dir = inflate_dir('~/.cache') file_check_path = inflate_dir('~/provision_installed') file_check = Chibi_file(file_check_path) version_to_check = "ponysay\n".format(file=__file__, ) if __name__ == "__main__" and not version_to_check in file_check: cowsay("Starting install for ponysay") yum.install('texinfo') original_dir = current_dir() cd(cache_dir) ponysay_dir = join(cache_dir, 'ponysay') if not exists(ponysay_dir): git.clone('https://github.com/erkin/ponysay.git', ponysay_dir) cd(ponysay_dir) command('python3', './setup.py', 'install', '--freedom=partial') cd(original_dir) file_check.append(version_to_check)
#!/usr/bin/env python3 from chibi.command import command, systemctl from chibi.command.echo import cowsay from chibi.file.snippets import join, copy, chown list_of_user_to_create = ['vagrant', "root"] databases = [ "vagrant", "root", "turning_db_dev", "turning_db_test", "turn_profiling" ] FOLDER_PROVISION = "/home/vagrant/provision/postgresql/provision" cowsay("provision posrgresql") copy(join(FOLDER_PROVISION, "pg_hba.conf"), "/var/lib/pgsql/9.6/data/pg_hba.conf", verbose=True) chown("/var/lib/pgsql/9.6/data/pg_hba.conf", user_name='postgres', group_name='postgres') copy(join(FOLDER_PROVISION, "postgresql.conf"), "/var/lib/pgsql/9.6/data/postgresql.conf", verbose=True) chown("/var/lib/pgsql/9.6/data/postgresql.conf", user_name='postgres', group_name='postgres') for database in databases:
from chibi.command.echo import cowsay from chibi.file.snippets import copy, join, chown list_of_user_to_create = [ 'dem4ply', "root" ] databases = [ "dem4ply", "root", "turning_db_dev", "turning_db_test", "turn_profiling", "laniidae_db_dev" ] FOLDER_PROVISION="/vagrant/provision/postgresql/provision" cowsay( "provisionado posrgresql" ) copy( join( FOLDER_PROVISION, "pg_hba.conf" ), "/var/lib/pgsql/9.5/data/pg_hba.conf", verbose=True ) chown( "/var/lib/pgsql/9.5/data/pg_hba.conf", user_name='postgres', group_name='postgres' ) copy( join( FOLDER_PROVISION, "postgresql.conf" ), "/var/lib/pgsql/9.5/data/postgresql.conf", verbose=True ) chown( "/var/lib/pgsql/9.5/data/postgresql.conf", user_name='postgres', group_name='postgres' )
#!/usr/bin/env python3 import sys import yaml from chibi.parser import to_bool from chibi.command import command, systemctl from chibi.file.snippets import exists, join, mkdir, chown, ls, copy from chibi.command.echo import cowsay cowsay( "iniciando kibana" ) FOLDER_PROVISION="/vagrant/provision/elasticsearch/provision" copy( join( FOLDER_PROVISION, 'kibana.yml' ), '/etc/kibana/kibana.yml', verbose=True ) systemctl.restart( "kibana" ) cowsay( "termino el inicio de kibana" )
#!/usr/bin/env python3 from chibi.command.echo import cowsay from chibi.file.snippets import join from chibi.file import Chibi_file provision_folder = '/vagrant/provision' file_host = 'hosts' dest = '/etc/hosts' if __name__ == "__main__": cowsay( "copy hosts file" ) origin_hosts = Chibi_file( join( provision_folder, file_host ) ) origin_hosts.copy( dest ) cowsay( "ending copy hosts file" )
#!/usr/bin/env python3 from chibi.command import systemctl from chibi.command.echo import cowsay from chibi.file.snippets import join, copy FOLDER_PROVISION = "/home/vagrant/provision/redis/provision" cowsay("provisionado redis") copy(join(FOLDER_PROVISION, "redis.conf"), "/etc/redis.conf", verbose=True) systemctl.restart("redis") cowsay("termino de provisionado redis")
from chibi.command import echo, yum from chibi.file import Chibi_file from chibi.file.snippets import inflate_dir, join, exists from chibi.net import download file_check_path = inflate_dir('~/provision_installed') file_check = Chibi_file(file_check_path) url_of_cowsay_rpm = ("http://www.melvilletheatre.com/articles/el7/" "cowsay-3.03-14.el7.centos.noarch.rpm") version_to_check = ("cowsay with {url}\n".format(file=__file__, url=url_of_cowsay_rpm)) cache_directory = inflate_dir('~/.cache/') full_path_cowsay_rpm = join(cache_directory, 'cowsay.rpm') if __name__ == "__main__" and not version_to_check in file_check: echo.echo('===============================') echo.echo('installing cowsay') echo.echo('===============================') if not exists(full_path_cowsay_rpm): download(url_of_cowsay_rpm, directory=cache_directory, file_name='cowsay.rpm') else: echo.echo("using cache for cowsay") yum.local_install(full_path_cowsay_rpm)