def handle(self, *args, **options):
        if len(args)>0:
            AWS_BUCKET_NAME = args[0]
        else:
            AWS_BUCKET_NAME = settings.AWS_BUCKET_NAME

        AWS_ACCESS_KEY_ID = settings.AWS_ACCESS_KEY_ID
        AWS_SECRET_ACCESS_KEY = settings.AWS_SECRET_ACCESS_KEY

        self.stdout.write('Using bucket: {}'.format(AWS_BUCKET_NAME))

        BASE_DIR = settings.BASE_DIR
        fixtures_dir = os.path.abspath(os.path.join(BASE_DIR, 'backend', 'fixtures'))

        fixture_name = os.path.join(fixtures_dir, 'local_data.json')

        #TODO setup app name below
        create_fixture('CHANGE APP NAME', fixture_name)

        conn = S3Connection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
        bucket = conn.get_bucket(AWS_BUCKET_NAME)
        os.chdir(BASE_DIR)
        k = bucket.new_key('fixtures/local_data.json')
        k.set_contents_from_filename(fixture_name)
        k.set_acl('public-read')
Example #2
0
 def __enter__(self):
     self.savedPath = None
     while not self.savedPath:
         try:
             self.savedPath = os.getcwd()
         except OSError:
             os.chdir("..")
     os.chdir(self.newPath)
    def handle(self, *args, **options):
        if len(args)>0:
            AWS_BUCKET_NAME = args[0]
        else:
            AWS_BUCKET_NAME = settings.AWS_BUCKET_NAME

        AWS_ACCESS_KEY_ID = settings.AWS_ACCESS_KEY_ID
        AWS_SECRET_ACCESS_KEY = settings.AWS_SECRET_ACCESS_KEY

        self.stdout.write('Using bucket: {}'.format(AWS_BUCKET_NAME))

        BASE_DIR = settings.BASE_DIR
        uploads_dir = os.path.abspath(os.path.join(BASE_DIR, 'uploads'))

        os.chdir(uploads_dir)
        call('tar cjvf assets.tar.bz2 *', shell=True)
        call('mv assets.tar.bz2 ..', shell=True)
        conn = S3Connection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
        bucket = conn.get_bucket(AWS_BUCKET_NAME)
        os.chdir(BASE_DIR)
        k = bucket.new_key('fixtures/assets.tar.bz2')
        k.set_contents_from_filename('assets.tar.bz2')
        k.set_acl('public-read')
    def handle(self, *args, **options):
        if len(args)>0:
            AWS_BUCKET_NAME = args[0]
        else:
            AWS_BUCKET_NAME = settings.AWS_BUCKET_NAME

        self.stdout.write('Using bucket: {}'.format(AWS_BUCKET_NAME))

        BASE_DIR = settings.BASE_DIR

        uploads_dir = os.path.abspath(os.path.join(BASE_DIR, 'uploads'))
        os.chdir(BASE_DIR)
        call('mkdir -p {}'.format(uploads_dir), shell=True)
        os.chdir(uploads_dir)
        try:
            call('rm -rf ./*', shell=True)
        except Exception as e:
            print e  # probably an empty directory
        call(
             'curl -sLO http://{}.s3.amazonaws.com/fixtures/assets.tar.bz2'.format(AWS_BUCKET_NAME),
             shell=True
             )
        call('tar xjvf assets.tar.bz2', shell=True)
        call('rm assets.tar.bz2', shell=True)
Example #5
0
def cd(newPath):
    with _lock:
        newPath = newPath or '.'
        savedPath = None
        while not savedPath:
            try:
                savedPath = os.getcwd()
            except OSError:
                os.chdir("..")
        os.chdir(newPath)
        try:
            yield
        finally:
            os.chdir(savedPath)
Example #6
0
def cd(newPath):
    with _lock:
        newPath = newPath or '.'
        savedPath = None
        while not savedPath:
            try:
                savedPath = os.getcwd()
            except OSError:
                os.chdir("..")
        _logger.debug('Changing working directory to %s' % newPath)
        os.chdir(newPath)
        try:
            yield
        finally:
            _logger.debug('Changing working directory to %s' % savedPath)
            os.chdir(savedPath)
Example #7
0
def vKVM_launcher(cimc_ip, c_user, c_password):
    print "%s에 vKVM에 접속합니다." % cimc_ip
    os.chdir(kvm_path)  # kvm 실행 위치로 변경
    cmd = "launchkvm.bat -u %s -p %s -h %s" % (c_user, c_password, cimc_ip)
    os.system(cmd)
    os.chdir(original_path)  # 기존 실행 위치로 변경: 환경/이미지 파일의 정상 참조를 위함
Example #8
0
def megacli(args):
    os.chdir('/opt/lsi/MegaCLI')
    cmd = './MegaCli ' + args
    p = Popen(cmd, shell=True, stdout=PIPE)
    (ret, err) = p.communicate()
    return ret
Example #9
0
 def __exit__(self, etype, value, traceback):
     os.chdir(self.savedPath)
Example #10
0
 def __enter__(self):
     self.savedPath = os.getcwd()
     os.chdir(self.newPath)
Example #11
0
def megacli(args):
    os.chdir('/opt/lsi/MegaCLI')
    cmd = './MegaCli ' + args
    Popen(cmd, shell=True)
 def __exit__(self, etype, value, traceback):
     os.chdir(self.savedPath)
 def __enter__(self):
     self.savedPath = os.getcwd()
     os.chdir(self.newPath)
def vKVM_launcher(cimc_ip, c_user, c_password):
    print "%s에 vKVM에 접속합니다." % cimc_ip
    os.chdir('c:\py\kvm')
    cmd = 'launchkvm.bat -u %s -p %s -h %s' % (c_user, c_password, cimc_ip)
    os.system(cmd)
Example #15
0
def vKVM_launcher(cimc_ip,c_user,c_password):   # vKVM에 접속 - 랙 서버 매니저
    print "%s에 vKVM에 접속합니다."%cimc_ip
    os.chdir("c:\kvm")
    cmd = "launchkvm.bat -u %s -p %s -h %s"%(c_user,c_password,cimc_ip)
    os.system(cmd)