Permalink
Browse files

added config:unset command

  • Loading branch information...
1 parent 6a43265 commit 9a7240af6a39d98d5c931fb67507002e08dedb66 @toolness committed Sep 8, 2012
Showing with 25 additions and 0 deletions.
  1. +8 −0 test/smoke_test.py
  2. +14 −0 vendor/tinyservlib/cmdline/local.py
  3. +3 −0 vendor/tinyservlib/host.py
View
@@ -137,6 +137,9 @@ def main():
describe("Creating tinyserv app on %s." % remote)
run("tinyserv apps:create")
+
+ describe("Ensuring app exists.")
+
contains(run("tinyserv apps").split(), "tinysmoke")
describe("Deploying app by pushing to %s." % remote)
@@ -161,6 +164,11 @@ def main():
run("tinyserv config:set foo=blargey")
equals(readurl(url), "foo is blargey")
+ describe("Undoing app environment changes.")
+
+ run("tinyserv config:unset foo")
+ equals(readurl(url), "foo is undefined")
+
describe("Checking app log.")
contains(run("tinyserv logs"), "listening on port %d\n" % config['port'])
@@ -94,6 +94,20 @@ def cmd_config(args):
remote.show_config(_get_current_project_name())
+def cmd_config__unset(args):
+ """
+ Clear environment keys.
+ """
+
+ settings = {}
+ for name in args.keys:
+ settings[name] = ''
+ remote.update_config(_get_current_project_name(), settings)
+
+def cmd_config__unset_args(parser):
+ parser.add_argument('keys', nargs='*',
+ help='keys to unset')
+
def cmd_config__set(args):
"""
Set environment keys and values.
@@ -101,6 +101,9 @@ def update_config(self, settings):
if not self.release.get('env'):
self.release['env'] = {}
self.release['env'].update(settings)
+ for key in self.release['env'].keys():
+ if not self.release['env'][key]:
+ del self.release['env'][key]
self._save_release()
print "Configuration updated."

0 comments on commit 9a7240a

Please sign in to comment.