Esempio n. 1
0
	def handle(self,*args,**kwargs):
		if not getattr(settings,"DEPLOYMENTS",False):
			print "Your settings module doesn't have a DEPLOYMENTS hash defined. Cannot continue."
			exit()
		installed_apps=settings.INSTALLED_APPS
		for appname in installed_apps:
			packages=(appname+".management.elsewhere.actions",)
			for package in packages: #tries to import management.elsewhere modules for each app, which allows for your own extensions
				try: __import__(package)
				except ImportError: pass
		instruction_names=kwargs.get("deploy",False)
		passwords=kwargs.get('passwords',False)
		if not instruction_names:
			print "You must supply deploy instruction names."
			exit()
		try: deploy.deploy(settings.DEPLOYMENTS,instruction_names,**passwords)
		except Exception, e:
			print str(e)
			exit()
Esempio n. 2
0
 def handle(self, *args, **kwargs):
     if not getattr(settings, "DEPLOYMENTS", False):
         print "Your settings module doesn't have a DEPLOYMENTS hash defined. Cannot continue."
         exit()
     installed_apps = settings.INSTALLED_APPS
     for appname in installed_apps:
         packages = (appname + ".management.elsewhere.actions", )
         for package in packages:  #tries to import management.elsewhere modules for each app, which allows for your own extensions
             try:
                 __import__(package)
             except ImportError:
                 pass
     instruction_names = kwargs.get("deploy", False)
     passwords = kwargs.get('passwords', False)
     if not instruction_names:
         print "You must supply deploy instruction names."
         exit()
     try:
         deploy.deploy(settings.DEPLOYMENTS, instruction_names, **passwords)
     except Exception, e:
         print str(e)
         exit()
Esempio n. 3
0
options = None
args = None
usage = "usage: elsware.py -c config -d slicehost [-d dreamhost] [-p slicehost[password] ]"
parser = OptionParser(usage=usage)
parser.add_option(
    "-d", "--deployment", dest="deployment", action="append", help="The deployment instruction(s) to run."
)
parser.add_option(
    "-c", "--config", dest="config", help="The configuration python module where the DEPLOYMENTS variable is set."
)
parser.add_option(
    dictopt.DictOption(
        "-p",
        "--passwords",
        action="dic",
        type="string",
        dest="passwords",
        help="Passwords for the 'password_in_opt' parameters. See elsware.core.dictopt.DictOption for examples.",
    )
)
(options, args) = parser.parse_args()
try:
    config = __import__(options.config)
except ImportError:
    print "Could not import the python module you specified for config. Try again."
    exit()
if not getattr(config, "DEPLOYMENTS", False):
    print "Your config module does not have a 'DEPLOYMENTS' variable defined. Not doing anything."
    exit(1)
deploy(config.DEPLOYMENTS, options.deployment, **getattr(options, "passwords", {}))
Esempio n. 4
0
                  "--deployment",
                  dest="deployment",
                  action="append",
                  help="The deployment instruction(s) to run.")
parser.add_option(
    "-c",
    "--config",
    dest="config",
    help=
    "The configuration python module where the DEPLOYMENTS variable is set.")
parser.add_option(
    dictopt.DictOption(
        "-p",
        "--passwords",
        action="dic",
        type="string",
        dest="passwords",
        help=
        "Passwords for the 'password_in_opt' parameters. See elsware.core.dictopt.DictOption for examples."
    ))
(options, args) = parser.parse_args()
try:
    config = __import__(options.config)
except ImportError:
    print "Could not import the python module you specified for config. Try again."
    exit()
if not getattr(config, "DEPLOYMENTS", False):
    print "Your config module does not have a 'DEPLOYMENTS' variable defined. Not doing anything."
    exit(1)
deploy(config.DEPLOYMENTS, options.deployment,
       **getattr(options, "passwords", {}))