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 support for new metadata, importsource tweak #12

Closed
wants to merge 8 commits into from

Conversation

mbassett
Copy link

@mbassett mbassett commented Feb 3, 2017

Add support for new information from ec2 instance metadata

Tweak importsource to also set tags.{key} variables for use in sync filters.

Fixes #2 and #5

mbassett and others added 5 commits October 31, 2016 17:57
Current extract tags function does not allow for the usage of the tags in the import filter.  

This small update creates variables in the expected format  tags.{attr}  so you can use that in your sync filters.
@mbassett
Copy link
Author

mbassett commented Feb 3, 2017

image

now the tags.{key} values are populated in preview view, and available for use in filters

@mbassett
Copy link
Author

mbassett commented Feb 3, 2017

I thought this fixed it for sync filters, but it seems to have only fixed the preview display tab.

:'(

@mbassett
Copy link
Author

mbassett commented Feb 3, 2017

So far as I can tell...

filters that work:
name
private_ip
image

filters that don't work:
tags.Name
tags.*
vpc_id
private_dns
state

I even tried adding new fields name_tag and asg_group_tag and those also did not work in filters (and yes i added them to the ImportSource.php also )

            $this->extractTags($entry, $object);
            $object->name_tag = $object->tags->{'Name'};
            if (isset($object->tags->{'aws:autoscaling:groupName'})) {
                $object->asg_group_tag = $object->tags->{'aws:autoscaling:groupName'};
            }

@mbassett
Copy link
Author

mbassett commented Feb 3, 2017

@Thomas-Gelf Can you tell me why this isn't working? I see values in the import source preview page, but they do not seem to be applying in the sync role.

specifically 283da03 and the other minor commits around it?

I see the value for disabled = 1 for hosts that are not in running state, but the sync rule does not disable them.

image

@walterheck
Copy link

@dnsmichi @Thomas-Gelf Can this be merged please?

@Thomas-Gelf
Copy link
Collaborator

@walterheck: sure! I'll check whether this is still necessary...

             $result->tags->{$t['Key']} = $t['Value'];
+            // so we can use these tags in the expected way in import filters via tags.attribute
+            $result->{'tags.'.$t['Key']} = $t['Value'];

...as in the meantime there should have been a related change in Director itself. The rest looks good! Sorry for the delay @mbassett, this got completely forgotten.

Cheers,
Thomas

@lippserd
Copy link
Member

Since #18 has been merged, I close this as duplicate. Thanks for your efforts though!

@lippserd lippserd closed this Aug 26, 2020
@lippserd lippserd removed the request for review from Thomas-Gelf August 26, 2020 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filters Expression in sync rule not working
4 participants