Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
b1e1624
update project structure and apply some fixes
Jan 23, 2024
287c9fd
update golangci-lint version in test workflow
Jan 23, 2024
73ecab3
bump google.golang.org/grpc and golang.org/x/net
Jan 24, 2024
1399eab
add baremetal/drivers and blockstorage/snapshots
Jan 25, 2024
ecdd35d
update baremetal drivers
Jan 30, 2024
41460ea
add baremetal tables
Feb 1, 2024
4b0f3da
add blockstorage/qos
Feb 2, 2024
d7b2de7
add availabiilty zones, backups, limits and qos for blockstorage
Feb 2, 2024
26238b3
fix spec and baremetal microversion
Feb 5, 2024
1ecfa74
add blockstorage/limits
Feb 5, 2024
1881c27
add compute/images
Feb 6, 2024
fbaa606
add service info in table names
Feb 6, 2024
431c8c8
add compute/limits
Feb 6, 2024
01795ce
add compute/network
Feb 6, 2024
9d6ae8f
apply formatting
Feb 6, 2024
99a028f
add compute/secgroups and small fix on compute/limits
Feb 7, 2024
83cf966
implement spec validation and comment tables without resource
Feb 7, 2024
4af157e
fix blockstorage/limits columns types
Feb 7, 2024
ba7a3f4
use gophercloud blockstorage/limits struct
Feb 7, 2024
17c1416
add compute/tenantnetworks and compute/serverusage
Feb 8, 2024
3f3659a
add blockstorage/quotasets and blockstorage/services
Feb 9, 2024
378b61b
add blockstorage/quotasets_usage
Feb 9, 2024
3cda75e
fix blockstorage/volumes_backups and compute/limits
Feb 9, 2024
6a93f4d
update error handling
Feb 9, 2024
765f6a8
apply formatting
Feb 9, 2024
f46f3fd
add identity/domains, tenants and imageservice members
Feb 9, 2024
f832cfc
add identity/services
Feb 12, 2024
b30a03b
fix small bugs
Feb 12, 2024
19fa3ed
change endpoint names
Feb 12, 2024
ae888ed
update dependecies and apply formatting
Feb 13, 2024
89ba6cd
use tagtype from utils
Feb 13, 2024
d97acdb
add include/exclude tables in spec. With @gambu94
Feb 13, 2024
7b69d22
fix match func, add some additional tests. With @gambu94
Feb 14, 2024
7dbac8f
apply formatting
Feb 14, 2024
e411e67
chore: remove unused func, add all available tables changing the spec…
Feb 14, 2024
f87a210
new destination DB URI and minor fixes on limits to solve incremental…
Feb 22, 2024
e52ad38
chore: update deps
Feb 29, 2024
479f824
chore: revert api naming
Feb 29, 2024
357ddad
fix: image service renaming
Feb 29, 2024
3bb09fe
fix: remove x := x in for loops, reduntant with Go1.22
Feb 29, 2024
f085d76
fix: client getTables method
Feb 29, 2024
e39f4a2
update goreleaser ldflags
Feb 29, 2024
8cceeec
fix: add kind to plugin init and change to var for ldflags to work
Mar 1, 2024
90e2302
fix: remove deprecated API
Mar 1, 2024
97b1c35
fix: remove commented code and apply formatting
Mar 1, 2024
d724a46
fix: image members and instance security groups
Mar 1, 2024
292da01
add: identity groups, regions, registeredlimits and roles
Mar 1, 2024
978a353
replace internals with cq-plugin-utils lib
Mar 5, 2024
2a58b04
add identity catalog
Mar 5, 2024
640f5db
fix: identity/services and remove catalog
Mar 7, 2024
1798a29
bump to plugin-sdk v4.32.1 and gophercloud v1.11.0
Mar 7, 2024
b573d6f
add checks on input spec
Mar 7, 2024
0853ff7
add check on spec at plugin loading time
Mar 11, 2024
7ac5c76
fix: check spec endpoint is not nil
Mar 11, 2024
42122b0
chore: update cq-plugin-utils
Mar 11, 2024
6ca84bb
fix: update .gjthub ci
Mar 11, 2024
c803aa2
update .gitignore
Mar 11, 2024
c422a96
fix: prevent go doc fail when spec is empty
Mar 11, 2024
e225263
fix: change from goreleaser to makefile.
Mar 11, 2024
c5ceee3
fix: golangci-lint workflow
Mar 11, 2024
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
43 changes: 20 additions & 23 deletions resources/internal/pattern_matcher/pattern_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import "github.com/gobwas/glob"
type PatternMatcher struct {
include []string
exclude []string
name string
}

// Option is the type for functional options.
Expand Down Expand Up @@ -51,29 +50,27 @@ func (pm *PatternMatcher) Match(value string) bool {
var g glob.Glob

is_included := false
is_excluded := false

for _, in := range pm.include {
g = glob.MustCompile(in)
is_included = g.Match(value)
if is_included {
break
}
}
// Check if the value matches any pattern in the pm.include list
for _, pattern := range pm.include {
g = glob.MustCompile(pattern)
matched := g.Match(value)
if matched {
is_included = true
break
}
}
if !is_included {
return false
}

for _, ex := range pm.exclude {
g = glob.MustCompile(ex)
is_excluded = g.Match(value)
if !is_excluded {
return true
}
}

if is_included && !is_excluded {
return true
}
return false
// Check if the value matches any pattern in the excluded list
for _, pattern := range pm.exclude {
g = glob.MustCompile(pattern)
matched := g.Match(value)
if matched {
return false
}
}
// If the value matches at least one pattern in the included list
// and does not match any pattern in the excluded list, return true
return true
}
26 changes: 22 additions & 4 deletions resources/internal/pattern_matcher/pattern_matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestPatternMatcher(t *testing.T) {
want bool
}{
{
"test1",
"test_1",
fields{
include: []string{"*"},
exclude: []string{},
Expand All @@ -25,7 +25,7 @@ func TestPatternMatcher(t *testing.T) {
true,
},
{
"test2",
"test_2",
fields{
include: []string{"*"},
exclude: []string{"hello*"},
Expand All @@ -34,14 +34,32 @@ func TestPatternMatcher(t *testing.T) {
false,
},
{
"test3",
"test_3",
fields{
include: []string{"*"},
exclude: []string{"hello*"},
},
"ciao_world",
"hi_world",
true,
},
{
"test_4",
fields{
include: []string{"hello"},
exclude: []string{"*"},
},
"hello",
false,
},
{
"test_5",
fields{
include: []string{"openstack_nova*", "openstack_cinder*"},
exclude: []string{"openstack_cinder_attachment*"},
},
"openstack_cinder_attachments",
false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down