Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #7 from SvenskaSpel/support_other_file_names_for_p…
Browse files Browse the repository at this point in the history
…olicies_file

Support other file names for policies file
  • Loading branch information
mrunesson authored Nov 15, 2018
2 parents 2cfa376 + d1e7f61 commit 741256e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions policytool/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def tags_to_atlas(srcdir, environment, hdfs, retry, verbose, config, tabletagfil
_tags_to_atlas(srcdir, environment, hdfs, retry, verbose, config, tabletagfile, columntagfile)


def _rules_to_ranger_cmd(srcdir, project_name, environment, config, verbose, dryrun, tabletagfile, columntagfile):
def _rules_to_ranger_cmd(srcdir, project_name, environment, config, verbose, dryrun, tabletagfile, columntagfile, policyfile):
conf = JSONPropertiesFile(config).get(environment)
table_file = os.path.join(srcdir, tabletagfile)
column_file = os.path.join(srcdir, columntagfile)
policy_file = os.path.join(srcdir, 'ranger_policies.json')
policy_file = os.path.join(srcdir, policyfile)
missing_files = _missing_files([table_file, column_file, policy_file])
if len(missing_files) != 0:
print("Following files are missing: " ", ".join(missing_files))
Expand Down Expand Up @@ -140,8 +140,9 @@ def _rules_to_ranger_cmd(srcdir, project_name, environment, config, verbose, dry
@click.option('--dryrun', help='Show commands, but do not update.', is_flag=True)
@click.option('--tabletagfile', help='The source file for table tags file', default='table_tags.csv')
@click.option('--columntagfile', help='The source file for column tags file', default='column_tags.csv')
def rules_to_ranger_cmd(srcdir, project_name, environment, config, verbose, dryrun, tabletagfile, columntagfile):
_rules_to_ranger_cmd(srcdir, project_name, environment, config, verbose, dryrun, tabletagfile, columntagfile)
@click.option('--policyfile', help='The source file for policy file', default='ranger_policies.json')
def rules_to_ranger_cmd(srcdir, project_name, environment, config, verbose, dryrun, tabletagfile, columntagfile, policyfile):
_rules_to_ranger_cmd(srcdir, project_name, environment, config, verbose, dryrun, tabletagfile, columntagfile, policyfile)


def _audit(srcdir, environment, config, tabletagfile, columntagfile):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def run_tests(self):

setup(
name="cobra-policytool",
version="1.1.3",
version="1.1.4",
author="Magnus Runesson",
author_email="[email protected]",
description="Tool for manage Hadoop access using Apache Atlas and Ranger.",
Expand Down

0 comments on commit 741256e

Please sign in to comment.