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

allow 'Root' as an OU name to apply a stackset to all accounts in our Organization #8

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/manifest/manifest_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ def get_accounts_in_ou(self, ou_id_to_account_map, ou_name_to_id_map,
ou_ids_manifest = []
# convert OU Name to OU IDs
for ou_name in resource.deploy_to_ou:

if ou_name == 'Root':
accounts_in_ou.extend(accounts_in_all_ous)

Comment on lines +155 to +158
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accounts_in_all_ous is not defined in this context. I believe a better change would be to lines 255 and 256 (now 259 and 260).

        _ou_name_to_id_map = {"Root":root_id}
        _all_ou_ids = [root_id]

ou_id = [value for key, value in ou_name_to_id_map.items()
if ou_name == key]
ou_ids_manifest.extend(ou_id)
Expand Down
6 changes: 5 additions & 1 deletion source/state_machine_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,11 @@ def get_ou_id(self, nested_ou_name, delimiter):
self.logger.info("Looking up the OU Id for OUName: {} with nested"
" ou delimiter: {}".format(nested_ou_name,
delimiter))
return self._get_ou_id(org, root_id, nested_ou_name, delimiter)
if nested_ou_name == 'Root':
self.logger.info("We want to apply this SCP to the Root level")
return root_id
else:
return self._get_ou_id(org, root_id, nested_ou_name, delimiter)

def _get_ou_id(self, org, parent_id, nested_ou_name, delimiter):
nested_ou_name_list = self._empty_separator_handler(
Expand Down