-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into issues/106
- Loading branch information
Showing
10 changed files
with
175 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# Copyright (c) 2017 Red Hat, Inc. | ||
# | ||
# This software is licensed to you under the GNU General Public License, | ||
# version 3 (GPLv3). There is NO WARRANTY for this software, express or | ||
# implied, including the implied warranties of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv3 | ||
# along with this software; if not, see | ||
# https://www.gnu.org/licenses/gpl-3.0.txt. | ||
# | ||
|
||
"""Serializer for system fingerprint models""" | ||
|
||
from rest_framework.serializers import ModelSerializer | ||
from api.fingerprint_model import SystemFingerprint | ||
|
||
|
||
class FingerprintSerializer(ModelSerializer): | ||
"""Serializer for the Fingerprint model.""" | ||
class Meta: | ||
"""Meta class for FingerprintSerializer.""" | ||
model = SystemFingerprint | ||
fields = '__all__' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# | ||
# Copyright (c) 2017 Red Hat, Inc. | ||
# | ||
# This software is licensed to you under the GNU General Public License, | ||
# version 3 (GPLv3). There is NO WARRANTY for this software, express or | ||
# implied, including the implied warranties of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv3 | ||
# along with this software; if not, see | ||
# https://www.gnu.org/licenses/gpl-3.0.txt. | ||
# | ||
|
||
"""Fingerprint engine ingests raw facts and produces system finger prints""" | ||
|
||
|
||
class Engine(): | ||
"""Engine that produces fingerprints from | ||
facts""" | ||
# pylint: disable= no-self-use | ||
|
||
def process_facts(self, fact_collection_id, facts): | ||
"""Process facts and convert to fingerprints | ||
:param fact_collection_id: id of fact collection | ||
associated with facts | ||
:param facts: facts to process | ||
:returns: fingerprints produced from facts | ||
""" | ||
|
||
fingerprints = [] | ||
for fact in facts: | ||
fingerprints.append(self.process_fact(fact_collection_id, fact)) | ||
return fingerprints | ||
|
||
def process_fact(self, fact_collection_id, fact): | ||
"""Process a fact and convert to a fingerprint | ||
:param fact_collection_id: id of fact collection | ||
associated with facts | ||
:param facts: fact to process | ||
:returns: fingerprint produced from fact | ||
""" | ||
fingerprint = {'fact_collection_id': fact_collection_id, | ||
'os_name': fact['etc_release_name'], | ||
'os_release': fact['etc_release_release'], | ||
'os_version': fact['etc_release_version']} | ||
|
||
return fingerprint |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters