changed logging order

This commit is contained in:
Kosta Mushkin
2025-07-25 15:03:39 -04:00
parent b6325c6ce4
commit 61e1bb6a67
27 changed files with 269 additions and 263 deletions
+6 -3
View File
@@ -35,13 +35,18 @@ Example Usage:
--client_secret "your-secret-here" \
--ignore_ssl
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
import json
from zvml import ZVMLClient
@@ -57,8 +62,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
logging.basicConfig(level=logging.INFO)
try:
# Connect to ZVM
client = ZVMLClient(
+7 -8
View File
@@ -36,12 +36,17 @@ Example Usage:
--ignore_ssl
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
import json
from zvml import ZVMLClient
@@ -57,12 +62,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Connect to ZVM
logging.info(f"Connecting to ZVM at {args.zvm_address}")
+7 -7
View File
@@ -5,12 +5,18 @@
# The author and Zerto further disclaim all implied warranties including, without limitation,
# any implied warranties of merchantability or of fitness for a particular purpose.
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import argparse
import sys
import os
import time
import paramiko
import logging
import urllib3
from zvml.client import Client
from zvml.encryptiondetection import EncryptionDetection
@@ -77,12 +83,6 @@ def main():
parser.add_argument("--vm_password", required=True, help="Linux VM password")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Setup client
client = setup_client(args)
+6 -7
View File
@@ -38,13 +38,18 @@ Example Usage:
--client_secret <client_secret> \
--ignore_ssl
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
import json
from zvml import ZVMLClient
@@ -61,12 +66,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Connect to ZVM
logging.info(f"Connecting to ZVM at {args.zvm_address}")
+17
View File
@@ -1,3 +1,20 @@
# Legal Disclaimer
# This script is an example script and is not supported under any Zerto support program or service.
# The author and Zerto further disclaim all implied warranties including, without limitation,
# any implied warranties of merchantability or of fitness for a particular purpose.
# In no event shall Zerto, its authors or anyone else involved in the creation,
# production or delivery of the scripts be liable for any damages whatsoever (including,
# without limitation, damages for loss of business profits, business interruption, loss of business
# information, or other pecuniary loss) arising out of the use of or the inability to use the sample
# scripts or documentation, even if the author or Zerto has been advised of the possibility of such damages.
# The entire risk arising out of the use or performance of the sample scripts and documentation remains with you.
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import json
import argparse
import sys
+6 -7
View File
@@ -38,13 +38,18 @@ Example Usage:
--license_key <license_key> \
--ignore_ssl
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
import json
from zvml import ZVMLClient
@@ -61,12 +66,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Connect to ZVM
logging.info(f"Connecting to ZVM at {args.zvm_address}")
+6 -8
View File
@@ -40,13 +40,17 @@ Example Usage:
--client_secret <client_secret> \
--ignore_ssl
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
import json
from zvml import ZVMLClient
@@ -62,12 +66,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Connect to ZVM
logging.info(f"Connecting to ZVM at {args.zvm_address}")
+6 -8
View File
@@ -43,13 +43,17 @@ Example Usage:
--site2_client_secret <secret2> \
--ignore_ssl
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
import json
import time
@@ -69,12 +73,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Initialize the site 1 client
site1_client = ZVMLClient(
+6 -8
View File
@@ -37,13 +37,17 @@ Example Usage:
--client_secret <client_secret> \
--ignore_ssl
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
from zvml import ZVMLClient
from zvml.server_date_time import DateTimeFormat
@@ -59,12 +63,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Connect to ZVM
logging.info(f"Connecting to ZVM at {args.zvm_address}")
+6 -7
View File
@@ -42,11 +42,16 @@ Example Usage:
--site_identifier <site_id> \
--ignore_ssl
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
@@ -65,12 +70,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Connect to ZVM
logging.info(f"Connecting to ZVM at {args.zvm_address}")
+6 -7
View File
@@ -40,8 +40,13 @@ Example Usage:
--ignore_ssl
"""
import argparse
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import argparse
import urllib3
import json
import sys
@@ -135,12 +140,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Setup client
client = setup_client(args)
+2 -2
View File
@@ -43,13 +43,13 @@ Example Usage:
--client_secret <client_secret> \
--ignore_ssl
"""
import argparse
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import argparse
import urllib3
import sys
import os
+6 -9
View File
@@ -44,13 +44,16 @@ Example Usage:
--client_secret <client_secret> \
--ignore_ssl
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
import json
from zvml import ZVMLClient
@@ -66,12 +69,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Initialize the client
client = ZVMLClient(
+6 -8
View File
@@ -56,13 +56,17 @@ Note: VM restore functionality is commented out in this example as it may return
# NOTE
# this example assumes that at least one VPG exists on the ZVM and protected VMs exist in the VPG
# the vm restore is commnted out as it fails with a 500
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
import json
from zvml import ZVMLClient
@@ -79,12 +83,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Connect to ZVM
logging.info(f"Connecting to ZVM at {args.zvm_address}")
+6 -6
View File
@@ -46,14 +46,17 @@ Example Usage:
Note: This script focuses on volume operations and requires only Site 1 credentials
since it performs read-only operations on the protected site.
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import urllib3
import argparse
import logging
import json
from zvml import ZVMLClient
@@ -68,9 +71,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
try:
# Initialize the client
client = ZVMLClient(args.zvm_address, args.client_id, args.client_secret, not args.ignore_ssl)
+6 -4
View File
@@ -69,13 +69,17 @@ Script Flow:
8. Generates test reports
9. Cleans up by deleting both VPGs
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
import json
from zvml import ZVMLClient
@@ -223,8 +227,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
logging.basicConfig(level=logging.DEBUG)
try:
vpg_structure = [
{
+3 -2
View File
@@ -71,12 +71,13 @@ Note: This script requires only protected site credentials. It's designed for VP
configuration backup and restore scenarios, allowing you to quickly recreate VPGs
with identical settings after changes or in disaster recovery situations.
"""
import argparse
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.DEBUG,
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import argparse
import urllib3
import json
import sys
@@ -69,12 +69,13 @@ Note: This script requires only protected site credentials. It's designed for VP
configuration backup and restore scenarios, allowing you to quickly recreate VPGs
with identical settings after changes or in disaster recovery situations.
"""
import argparse
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import argparse
import urllib3
import json
import sys
+17 -1
View File
@@ -1,5 +1,21 @@
import argparse
# Legal Disclaimer
# This script is an example script and is not supported under any Zerto support program or service.
# The author and Zerto further disclaim all implied warranties including, without limitation,
# any implied warranties of merchantability or of fitness for a particular purpose.
# In no event shall Zerto, its authors or anyone else involved in the creation,
# production or delivery of the scripts be liable for any damages whatsoever (including,
# without limitation, damages for loss of business profits, business interruption, loss of business
# information, or other pecuniary loss) arising out of the use of or the inability to use the sample
# scripts or documentation, even if the author or Zerto has been advised of the possibility of such damages.
# The entire risk arising out of the use or performance of the sample scripts and documentation remains with you.
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import argparse
import urllib3
import json
import sys
+3 -2
View File
@@ -57,13 +57,12 @@ Script Flow:
8. Cleans up by deleting both VPGs
"""
# Configure logging BEFORE any imports
import logging
# Configure logging before any other imports or code
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import argparse
import urllib3
import json
@@ -106,6 +105,8 @@ def main():
parser.add_argument("--vm2", required=True, help="Name of second VM to protect")
args = parser.parse_args()
logging.warning("TEST TEST TEST")
try:
# Setup clients and get site identifiers
client1 = setup_clients(args)
+6 -9
View File
@@ -59,10 +59,13 @@ confirmation. It demonstrates proper error handling and logging for VRA manageme
operations.
"""
#!/usr/bin/python3
import argparse
# Configure logging BEFORE any imports
import logging
# logging.basicConfig(level=logging.DEBUG)
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import argparse
import urllib3
import json
import sys
@@ -206,12 +209,6 @@ def main():
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Setup client
client = setup_client(args)
+6 -8
View File
@@ -60,13 +60,17 @@ Script Flow:
Note: This script demonstrates basic ZORG management capabilities and can be used
as a foundation for more complex ZORG operations and automation.
"""
# Configure logging BEFORE any imports
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import logging
import urllib3
import json
from zvml import ZVMLClient
@@ -83,12 +87,6 @@ def main():
parser.add_argument("--zorg_id", help="Optional: Specific ZORG ID to query")
args = parser.parse_args()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Connect to ZVM
logging.info(f"Connecting to ZVM at {args.zvm_address}")