Git Product home page Git Product logo

Comments (8)

iranzo avatar iranzo commented on June 12, 2024

@larsks willing to take this?

from risu.

iranzo avatar iranzo commented on June 12, 2024

Seems that:

g.add_argument("-i", "--include",
               metavar='SUBSTRING',
               help=_("Only include plugins that contain substring"),
               default=[],
               action='append')
g.add_argument("-x", "--exclude",
               metavar='SUBSTRING',
               help=_("Exclude plugins that contain substring"),
               default=[],
               action='append')

Both include are exclude are expected to be arrays, but the filter just works if the provided value is a string:

In [7]: len(citellus.findplugins(folders=['citellus/plugins/'], exclude='system'))
Out[7]: 25

In [8]: len(citellus.findplugins(folders=['citellus/plugins/'], exclude=['system']))
Out[8]: 28

from risu.

iranzo avatar iranzo commented on June 12, 2024

Seems that what the first filter excludes, the second appends so we end up with the full list

from risu.

iranzo avatar iranzo commented on June 12, 2024

In [22]: exclude = ['system', 'sriov']

In [23]: [plugin for plugin in plugins for filter in exclude if filter not in plugin]
Out[23]:
['citellus/plugins/bugzilla/httpd_bug_1406417.sh',
'citellus/plugins/bugzilla/httpd_bug_1406417.sh',
'citellus/plugins/launchpad/keystone_bug_1649616.sh',
'citellus/plugins/launchpad/keystone_bug_1649616.sh',
'citellus/plugins/network/external_connectivity.sh',
'citellus/plugins/network/external_connectivity.sh',
'citellus/plugins/openstack/ceilometer/expiration.sh',
'citellus/plugins/openstack/ceilometer/expiration.sh',
'citellus/plugins/openstack/ceph/ceph-status.sh',
'citellus/plugins/openstack/ceph/ceph-status.sh',
'citellus/plugins/openstack/cinder/lvm.sh',
'citellus/plugins/openstack/cinder/lvm.sh',
'citellus/plugins/openstack/crontab/heat_stack-purge.sh',
'citellus/plugins/openstack/crontab/heat_stack-purge.sh',
'citellus/plugins/openstack/crontab/keystone_cleanup.sh',
'citellus/plugins/openstack/crontab/keystone_cleanup.sh',
'citellus/plugins/openstack/debug.sh',
'citellus/plugins/openstack/debug.sh',
'citellus/plugins/openstack/hardware/memory.sh',
'citellus/plugins/openstack/hardware/memory.sh',
'citellus/plugins/openstack/iptables/metadata_redirect.sh',
'citellus/plugins/openstack/iptables/metadata_redirect.sh',
'citellus/plugins/openstack/keystone/cleanup_last-run.sh',
'citellus/plugins/openstack/keystone/cleanup_last-run.sh',
'citellus/plugins/openstack/keystone/cleanup_runs.sh',
'citellus/plugins/openstack/keystone/cleanup_runs.sh',
'citellus/plugins/openstack/mysql/keystone_tokendb.sh',
'citellus/plugins/openstack/mysql/keystone_tokendb.sh',
'citellus/plugins/openstack/mysql/seqno.sh',
'citellus/plugins/openstack/mysql/seqno.sh',
'citellus/plugins/openstack/network/sriov.sh',
'citellus/plugins/openstack/nova/incompatible-aggregate-capabilities-filters.sh',
'citellus/plugins/openstack/nova/incompatible-aggregate-capabilities-filters.sh',
'citellus/plugins/openstack/rabbitmq/file_descriptors.sh',
'citellus/plugins/openstack/rabbitmq/file_descriptors.sh',
'citellus/plugins/openstack/rabbitmq/rpc_issues.sh',
'citellus/plugins/openstack/rabbitmq/rpc_issues.sh',
'citellus/plugins/openstack/swift/ring-status.sh',
'citellus/plugins/openstack/swift/ring-status.sh',
'citellus/plugins/openstack/systemd/services.sh',
'citellus/plugins/openstack/traceback.sh',
'citellus/plugins/openstack/traceback.sh',
'citellus/plugins/openstack/version.sh',
'citellus/plugins/openstack/version.sh',
'citellus/plugins/pacemaker/failed_actions.sh',
'citellus/plugins/pacemaker/failed_actions.sh',
'citellus/plugins/pacemaker/fence_device.sh',
'citellus/plugins/pacemaker/fence_device.sh',
'citellus/plugins/pacemaker/nodes_number.sh',
'citellus/plugins/pacemaker/nodes_number.sh',
'citellus/plugins/pacemaker/packages.sh',
'citellus/plugins/pacemaker/packages.sh',
'citellus/plugins/pacemaker/stonith_enabled.sh',
'citellus/plugins/pacemaker/stonith_enabled.sh',
'citellus/plugins/pacemaker/stopped_resources.sh',
'citellus/plugins/pacemaker/stopped_resources.sh',
'citellus/plugins/system/baremetal.sh',
'citellus/plugins/system/clock-0-ntp-services.sh',
'citellus/plugins/system/clock-1-chrony.sh',
'citellus/plugins/system/clock-1-ntpd.sh',
'citellus/plugins/system/disk_usage.sh',
'citellus/plugins/system/hardware_virtualization.sh',
'citellus/plugins/system/kernel_panic.sh',
'citellus/plugins/system/rh-release.sh',
'citellus/plugins/system/selinux_config.sh',
'citellus/plugins/system/selinux_runtime.sh',
'citellus/plugins/system/updates.sh']

Duplicates show that the filters pass twice, hence the issue

from risu.

iranzo avatar iranzo commented on June 12, 2024

Note that sriov and system are just listed 'once' because they just pass one of the filters

from risu.

iranzo avatar iranzo commented on June 12, 2024

Using standard modified loop:

In [41]: newplugins = []
...: for plugin in plugins:
...: addplugin = True
...: for filter in exclude:
...: if filter in plugin:
...: addplugin = False
...: print "EXCLUDED: %s because of filter: %s" %(plugin, filter)
...: if addplugin:
...: newplugins.append(plugin)
...:
EXCLUDED: citellus/plugins/openstack/network/sriov.sh because of filter: sriov
EXCLUDED: citellus/plugins/openstack/systemd/services.sh because of filter: system
EXCLUDED: citellus/plugins/system/baremetal.sh because of filter: system
EXCLUDED: citellus/plugins/system/clock-0-ntp-services.sh because of filter: system
EXCLUDED: citellus/plugins/system/clock-1-chrony.sh because of filter: system
EXCLUDED: citellus/plugins/system/clock-1-ntpd.sh because of filter: system
EXCLUDED: citellus/plugins/system/disk_usage.sh because of filter: system
EXCLUDED: citellus/plugins/system/hardware_virtualization.sh because of filter: system
EXCLUDED: citellus/plugins/system/kernel_panic.sh because of filter: system
EXCLUDED: citellus/plugins/system/rh-release.sh because of filter: system
EXCLUDED: citellus/plugins/system/selinux_config.sh because of filter: system
EXCLUDED: citellus/plugins/system/selinux_runtime.sh because of filter: system
EXCLUDED: citellus/plugins/system/updates.sh because of filter: system

from risu.

iranzo avatar iranzo commented on June 12, 2024

Fixed in:

https://review.gerrithub.io/375712

from risu.

zerodayz avatar zerodayz commented on June 12, 2024

Merged

from risu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.