����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Copyright [2017] [Red Hat, Inc.]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Implement ConfigMapHash and SecretHash equivalents
# Based on https://github.com/kubernetes/kubernetes/pull/49961
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import json
import hashlib
try:
import string
maketrans = string.maketrans
except AttributeError:
maketrans = str.maketrans
try:
from collections import OrderedDict
except ImportError:
from orderreddict import OrderedDict
def sorted_dict(unsorted_dict):
result = OrderedDict()
for (k, v) in sorted(unsorted_dict.items()):
if isinstance(v, dict):
v = sorted_dict(v)
result[k] = v
return result
def generate_hash(resource):
# Get name from metadata
metada = resource.get("metadata", {})
key = "name"
resource["name"] = metada.get("name", "")
generate_name = metada.get("generateName", "")
if resource["name"] == "" and generate_name:
del resource["name"]
key = "generateName"
resource["generateName"] = generate_name
if resource["kind"] == "ConfigMap":
marshalled = marshal(sorted_dict(resource), ["data", "kind", key])
del resource[key]
return encode(marshalled)
if resource["kind"] == "Secret":
marshalled = marshal(sorted_dict(resource), ["data", "kind", key, "type"])
del resource[key]
return encode(marshalled)
raise NotImplementedError
def marshal(data, keys):
ordered = OrderedDict()
for key in keys:
ordered[key] = data.get(key, "")
return json.dumps(ordered, separators=(",", ":")).encode("utf-8")
def encode(resource):
return (
hashlib.sha256(resource).hexdigest()[:10].translate(maketrans("013ae", "ghkmt"))
)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| client | Folder | 0755 |
|
|
| k8s | Folder | 0755 |
|
|
| __init__.py | File | 0 B | 0644 |
|
| _version.py | File | 12.4 KB | 0644 |
|
| ansiblemodule.py | File | 727 B | 0644 |
|
| apply.py | File | 11.16 KB | 0644 |
|
| args_common.py | File | 2.71 KB | 0644 |
|
| common.py | File | 58.53 KB | 0644 |
|
| copy.py | File | 15.35 KB | 0644 |
|
| exceptions.py | File | 736 B | 0644 |
|
| hashes.py | File | 2.27 KB | 0644 |
|
| helm.py | File | 9.25 KB | 0644 |
|
| helm_args_common.py | File | 1.05 KB | 0644 |
|
| k8sdynamicclient.py | File | 1.77 KB | 0644 |
|
| selector.py | File | 2.89 KB | 0644 |
|
| version.py | File | 597 B | 0644 |
|