Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --show-config option that prints the configuration to stdout or errors #317

Merged
merged 2 commits into from Nov 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion dynamic_dynamodb/__init__.py
Expand Up @@ -20,6 +20,7 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
import json
import re
import sys
import time
Expand Down Expand Up @@ -55,7 +56,9 @@ def run(self):
def main():
""" Main function called from dynamic-dynamodb """
try:
if get_global_option('daemon'):
if get_global_option('show_config'):
print json.dumps(config.get_configuration(), indent=2)
elif get_global_option('daemon'):
daemon = DynamicDynamoDBDaemon(
'{0}/dynamic-dynamodb.{1}.pid'.format(
get_global_option('pid_file_dir'),
Expand Down
1 change: 1 addition & 0 deletions dynamic_dynamodb/config/__init__.py
Expand Up @@ -16,6 +16,7 @@
'daemon': False,
'instance': 'default',
'dry_run': False,
'show_config': False,
'pid_file_dir': '/tmp',
'run_once': False,

Expand Down
4 changes: 4 additions & 0 deletions dynamic_dynamodb/config/command_line_parser.py
Expand Up @@ -21,6 +21,10 @@ def parse():
'--run-once',
action='store_true',
help='Run once and then exit Dynamic DynamoDB, instead of looping')
parser.add_argument(
'--show-config',
action='store_true',
help='Parse config files, print parsed data and then exit Dynamic DynamoDB')
parser.add_argument(
'--check-interval',
type=int,
Expand Down