Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

python - Maintaining environment state between subprocess.Popen commands? -


i'm writing deployment engine our system, each project specifies custom deployment instructions.

the nodes running on ec2.

one of projects depends on source version of 3rd party application.

specifically:

cd /tmp wget s3://.../tools/x264_20_12_2010.zip unzip x264_20_12_2010.zip cd x264_20_12_2010 ./configure make checkinstall --pkgname=x264 --pkgversion "2:0.head" --backup=no --deldoc=yes --fstrans=no --default 

currently i'm doing boto's shellcommand (which uses subprocess.popen internally), looks this:

def deploy():         shellcommand("apt-get remove ffmpeg x264 libx264-dev")         shellcommand("apt-get update")         shellcommand("apt-get install -y build-essential checkinstall yasm texi2html libfuse-dev fuse-utils libcurl4-openssl-dev libxml2-dev mime-support libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libvpx-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev")          shellcommand("cd /tmp")         s3cmd_sync("s3://.../tools/x264_20_12_2010.zip", "/tmp/x264_20_12_2010.zip")         shellcommand("unzip x264_20_12_2010.zip")         shellcommand("cd x264_20_12_2010")         shellcommand("./configure")         shellcommand("make")         shellcommand(r'checkinstall --pkgname=x264 --pkgversion "2:0.head" --backup=no --deldoc=yes --fstrans=no --default') 

sadly fails, because cd /tmp applies subprocess, meaning once return the father process , issue second shellcommand exeenv inherited father, leans me think need execution framework shell commands apply commands in same sub process without loosing context.

what recommend solution problem? please note loggings of command line executed app important (how can debug without it?), why shellcommand... (see boto logging if interested).

thank you,
maxim.

  1. think of os.chdir("directory") instead of popen("cd directory")

  2. maybe it's best here not execute new shell each command: write 1 multi-line shell skript

deploy_commands = """apt-get foo apt-get bar cd baz ; boo bat"""

end execute via popen(deploy_commands, shell=true).

but please read security warning in popen documentation not escaping untrusted parameters.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -