Module: Yast::DnsServerCmdlineInclude
- Defined in:
- ../../src/include/dns-server/cmdline.rb
Instance Method Summary (collapse)
- - (Object) DNSHandlerACLs(options)
- - (Object) DNSHandlerACLsShow
-
- (Object) DNSHandlerForwarders(options)
Function for handling commandline 'forwarders'.
- - (Object) DNSHandlerHostRecords(options)
- - (Object) DNSHandlerHostRecordsShow(only_for_zone)
-
- (Object) DNSHandlerLogging(options)
Function for handling logging settings.
- - (Object) DNSHandlerLoggingShow
- - (Object) DNSHandlerMailServers(options)
- - (Object) DNSHandlerMailServersShow(only_for_zone)
- - (Object) DNSHandlerNameServers(options)
- - (Object) DNSHandlerNameServersShow(only_for_zone)
- - (Object) DNSHandlerResourceRecords(options)
- - (Object) DNSHandlerResourceRecordsShow(only_for_zone, only_for_type)
- - (Object) DNSHandlerSOA(options)
- - (Object) DNSHandlerSOAShow(only_for_zone)
-
- (Object) DNSHandlerStartup(options)
Function for handling commandline 'startup'.
- - (Object) DNSHandlerTransport(options)
- - (Object) DNSHandlerTransportShow(only_for_zone)
-
- (Object) DNSHandlerZones(options)
Function for handling DNS zones in general.
- - (Object) DNSHandlerZonesShow
-
- (Object) GetLoggingAdditionals
Function returns map $[ queries : (yes|no), updates : (yes|no), transfers : (yes|no) ].
- - (Object) initialize_dns_server_cmdline(include_target)
-
- (Object) Missing(missing_parameter)
Function prints commandline error about missing parameter.
-
- (Object) ScreenWizard(header, content)
Wizard Screen function formats and prints unifyied commandline screen.
- - (Object) SetLogTo(settings)
-
- (Object) UnknownValue(cmdline_parameter)
Function prints commandline error about unknown value for option.
Instance Method Details
- (Object) DNSHandlerACLs(options)
954 955 956 957 958 959 960 961 |
# File '../../src/include/dns-server/cmdline.rb', line 954 def DNSHandlerACLs() = deep_copy() if Ops.get(, "show") != nil DNSHandlerACLsShow() return false end false end |
- (Object) DNSHandlerACLsShow
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 |
# File '../../src/include/dns-server/cmdline.rb', line 916 def DNSHandlerACLsShow table_items = [] Builtins.foreach(DnsServerAPI.GetACLs) do |name, acl_values| table_items = Builtins.add( table_items, [ name, Ops.get(acl_values, "default", "no") == "yes" ? # TRANSLATORS: table item - ACL type _("Predefined") : # TRANSLATORS: table item - ACL type _("Custom"), Ops.get(acl_values, "value", "") ] ) end ScreenWizard( # TRANSLATORS: commandline section header _("ACLs:"), # TRANSLATORS: commandline table header item String.TextTable( [ # TRANSLATORS: commandline table header item _("Name"), # TRANSLATORS: commandline table header item _("Type"), # TRANSLATORS: commandline table header item _("Value") ], table_items, {} ) ) false end |
- (Object) DNSHandlerForwarders(options)
Function for handling commandline 'forwarders'
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
# File '../../src/include/dns-server/cmdline.rb', line 563 def DNSHandlerForwarders() = deep_copy() # show current settings if Ops.get(, "show") != nil table_items = [] Builtins.foreach(DnsServerAPI.GetForwarders) do |ip| table_items = Builtins.add(table_items, [ip]) end ScreenWizard( # TRANSLATORS: commandline section header, _("Forwarding:"), # TRANSLATORS: commandline table header item String.TextTable([_("Forwarder IP")], table_items, {}) ) return false elsif Ops.get(, "add") != nil && Ops.get(, "remove") != nil # TRANSLATORS: commandline error message CommandLine.Error(_("Only one action parameter is allowed.")) return false elsif Ops.get(, "add") != nil ip = Ops.get_string(, "ip", "") if ip == "" Missing("ip") return false end return DnsServerAPI.AddForwarder(ip) elsif Ops.get(, "remove") != nil ip = Ops.get_string(, "ip", "") if ip == "" Missing("ip") return false end return DnsServerAPI.RemoveForwarder(ip) end false end |
- (Object) DNSHandlerHostRecords(options)
1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 |
# File '../../src/include/dns-server/cmdline.rb', line 1297 def DNSHandlerHostRecords() = deep_copy() if Ops.get(, "show") != nil DNSHandlerHostRecordsShow(Ops.get_string(, "zone")) return false elsif Ops.get(, "add") != nil && Ops.get(, "remove") != nil CommandLine.Error(_("Only one action parameter is allowed.")) return false elsif Ops.get(, "add") != nil return DnsServerAPI.AddHost( Ops.get_string(, "zone", ""), Ops.get_string(, "hostname", ""), Ops.get_string(, "ip", "") ) elsif Ops.get(, "remove") != nil return DnsServerAPI.RemoveHost( Ops.get_string(, "zone", ""), Ops.get_string(, "hostname", ""), Ops.get_string(, "ip", "") ) end nil end |
- (Object) DNSHandlerHostRecordsShow(only_for_zone)
1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 |
# File '../../src/include/dns-server/cmdline.rb', line 1264 def DNSHandlerHostRecordsShow(only_for_zone) table_items = [] Builtins.foreach(DnsServerAPI.GetZoneHosts(only_for_zone)) do |hosts| table_items = Builtins.add( table_items, [ Ops.get(hosts, "zone", ""), Ops.get(hosts, "hostname", ""), Ops.get(hosts, "ip", "") ] ) end ScreenWizard( # TRANSLATORS: commandline section header _("Hostname Record:"), # TRANSLATORS: commandline table header item String.TextTable( [ # TRANSLATORS: commandline table header item _("Zone"), # TRANSLATORS: commandline table header item _("Hostname"), # TRANSLATORS: commandline table header item _("IP") ], table_items, {} ) ) true end |
- (Object) DNSHandlerLogging(options)
Function for handling logging settings
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File '../../src/include/dns-server/cmdline.rb', line 755 def DNSHandlerLogging() = deep_copy() # show current settings if Ops.get(, "show") != nil DNSHandlerLoggingShow() elsif Ops.get(, "destination") != nil # logging to syslog if Ops.get(, "destination") == "syslog" return DnsServerAPI.SetLoggingChannel({ "destination" => "syslog" }) # logging to file elsif Ops.get(, "destination") == "file" return DnsServerAPI.SetLoggingChannel( { "destination" => "file", "filename" => Ops.get_string(, "file", ""), "size" => Ops.get_string(, "maxsize", ""), "versions" => Ops.get_string(, "maxversions", "") } ) # unknown value else UnknownValue("destination") return false end elsif Ops.get(, "set") != nil category_mapping = { "queries" => "queries", "updates" => "xfer-in", "transfers" => "xfer-out" } current_categories = DnsServerAPI.GetLoggingCategories Builtins.foreach(["queries", "updates", "transfers"]) do |category| if Ops.get(, category) != nil enable = Builtins.tolower(Ops.get_string(, category)) == "yes" if enable Builtins.y2milestone("Enabling %1", category) current_categories = Builtins.toset( Builtins.add( current_categories, Ops.get(category_mapping, category, "") ) ) else Builtins.y2milestone("Disabling %1", category) current_categories = Builtins.filter(current_categories) do |current| Ops.get(category_mapping, category, "") != current end end end end return DnsServerAPI.SetLoggingCategories(current_categories) end false end |
- (Object) DNSHandlerLoggingShow
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 |
# File '../../src/include/dns-server/cmdline.rb', line 641 def DNSHandlerLoggingShow table_items = [] logging_channel = DnsServerAPI.GetLoggingChannel if Ops.get(logging_channel, "destination", "syslog") == "syslog" table_items = Builtins.add( table_items, [ # TRANSLATORS: commandline table item _("Logging destination"), # TRANSLATORS: commandline table item _("System log") ] ) elsif Ops.get(logging_channel, "destination", "file") == "file" table_items = Builtins.add( table_items, [ # TRANSLATORS: commandline table item _("Logging destination"), # TRANSLATORS: commandline table item _("File") ] ) table_items = Builtins.add( table_items, [ # TRANSLATORS: commandline table item _("Filename"), Ops.get(logging_channel, "filename", "") ] ) table_items = Builtins.add( table_items, [ # TRANSLATORS: commandline table item _("Maximum size"), Ops.get(logging_channel, "size", "") ] ) table_items = Builtins.add( table_items, [ # TRANSLATORS: commandline table item _("Maximum versions"), Ops.get(logging_channel, "versions", "") ] ) end logadds = GetLoggingAdditionals() # $[ "queries" : "no", "updates" : "no", "transfers" : "no" ] tabadds_items = [] tabadds_items = Builtins.add( tabadds_items, [ # TRANSLATORS: commandline table item, do not translate named _("Log named queries"), Ops.get(logadds, "queries", "") ] ) tabadds_items = Builtins.add( tabadds_items, [ # TRANSLATORS: commandline table item _("Log zone updates"), Ops.get(logadds, "xfer-in", "") ] ) tabadds_items = Builtins.add( tabadds_items, [ # TRANSLATORS: commandline table item _("Log zone transfers"), Ops.get(logadds, "xfer-out", "") ] ) ScreenWizard( # TRANSLATORS: commandline section header _("Logging Settings:"), Ops.add( Ops.add( String.TextTable( [ # TRANSLATORS: commandline table header item _("Setting"), # TRANSLATORS: commandline table header item _("Value") ], table_items, {} ), "\n\n" ), String.TextTable( [ # TRANSLATORS: commandline table header item _("Logging Rule"), # TRANSLATORS: commandline table header item _("Value") ], tabadds_items, {} ) ) ) nil end |
- (Object) DNSHandlerMailServers(options)
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 |
# File '../../src/include/dns-server/cmdline.rb', line 1102 def DNSHandlerMailServers() = deep_copy() if Ops.get(, "show") != nil DNSHandlerMailServersShow(Ops.get_string(, "zone")) return false elsif Ops.get(, "add") != nil && Ops.get(, "remove") != nil CommandLine.Error(_("Only one action parameter is allowed.")) return false elsif Ops.get(, "add") != nil DnsServerAPI.AddZoneMailServer( Ops.get_string(, "zone"), Ops.get_string(, "mx"), Ops.get_integer(, "priority") ) elsif Ops.get(, "remove") != nil if Ops.get(, "priority") == nil Missing("priority") return false end DnsServerAPI.RemoveZoneMailServer( Ops.get_string(, "zone"), Ops.get_string(, "mx"), Ops.get_integer(, "priority") ) end false end |
- (Object) DNSHandlerMailServersShow(only_for_zone)
1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 |
# File '../../src/include/dns-server/cmdline.rb', line 1065 def DNSHandlerMailServersShow(only_for_zone) table_items = [] Builtins.foreach(DnsServerAPI.GetZones) do |zone_name, zone| # skipping all zones which arent requested next if only_for_zone != nil && only_for_zone != zone_name Builtins.foreach(DnsServerAPI.GetZoneMailServers(zone_name)) do |mailserver| table_items = Builtins.add( table_items, [ zone_name, Ops.get(mailserver, "name", ""), Ops.get(mailserver, "priority", "") ] ) end end ScreenWizard( # TRANSLATORS: commandline section header _("Mail Servers:"), # TRANSLATORS: commandline table header item String.TextTable( [ # TRANSLATORS: commandline table header item _("Zone"), # TRANSLATORS: commandline table header item _("Mail Server"), # TRANSLATORS: commandline table header item _("Priority") ], table_items, {} ) ) true end |
- (Object) DNSHandlerNameServers(options)
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 |
# File '../../src/include/dns-server/cmdline.rb', line 1043 def DNSHandlerNameServers() = deep_copy() if Ops.get(, "show") != nil DNSHandlerNameServersShow(Ops.get_string(, "zone")) return false elsif Ops.get(, "add") != nil && Ops.get(, "remove") != nil CommandLine.Error(_("Only one action parameter is allowed.")) return false elsif Ops.get(, "add") != nil DnsServerAPI.AddZoneNameServer( Ops.get_string(, "zone"), Ops.get_string(, "ns") ) elsif Ops.get(, "remove") != nil DnsServerAPI.RemoveZoneNameServer( Ops.get_string(, "zone"), Ops.get_string(, "ns") ) end false end |
- (Object) DNSHandlerNameServersShow(only_for_zone)
1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 |
# File '../../src/include/dns-server/cmdline.rb', line 1015 def DNSHandlerNameServersShow(only_for_zone) table_items = [] Builtins.foreach(DnsServerAPI.GetZones) do |zone_name, zone| # skipping all zones which arent requested next if only_for_zone != nil && only_for_zone != zone_name Builtins.foreach(DnsServerAPI.GetZoneNameServers(zone_name)) do |nameserver| table_items = Builtins.add(table_items, [zone_name, nameserver]) end end ScreenWizard( # TRANSLATORS: commandline section header _("Name Servers:"), # TRANSLATORS: commandline table header item String.TextTable( [ # TRANSLATORS: commandline table header item _("Zone"), # TRANSLATORS: commandline table header item _("Name Server") ], table_items, {} ) ) true end |
- (Object) DNSHandlerResourceRecords(options)
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 |
# File '../../src/include/dns-server/cmdline.rb', line 1235 def DNSHandlerResourceRecords() = deep_copy() if Ops.get(, "show") != nil DNSHandlerResourceRecordsShow( Ops.get_string(, "zone"), Ops.get_string(, "type") ) return false elsif Ops.get(, "add") != nil && Ops.get(, "remove") != nil CommandLine.Error(_("Only one action parameter is allowed.")) return false elsif Ops.get(, "add") != nil return DnsServerAPI.AddZoneRR( Ops.get_string(, "zone", ""), Ops.get_string(, "type", ""), Ops.get_string(, "query", ""), Ops.get_string(, "value", "") ) elsif Ops.get(, "remove") != nil return DnsServerAPI.RemoveZoneRR( Ops.get_string(, "zone", ""), Ops.get_string(, "type", ""), Ops.get_string(, "query", ""), Ops.get_string(, "value", "") ) end false end |
- (Object) DNSHandlerResourceRecordsShow(only_for_zone, only_for_type)
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 |
# File '../../src/include/dns-server/cmdline.rb', line 1190 def DNSHandlerResourceRecordsShow(only_for_zone, only_for_type) table_items = [] Builtins.foreach(DnsServerAPI.GetZones) do |zone_name, zone| # skipping all zones which arent requested next if only_for_zone != nil && only_for_zone != zone_name Builtins.foreach(DnsServerAPI.GetZoneRRs(zone_name)) do |resourcerecord| # filtering rr types if only_for_type != nil && only_for_type != Ops.get(resourcerecord, "type") next end table_items = Builtins.add( table_items, [ zone_name, Ops.get(resourcerecord, "key", ""), Ops.get(resourcerecord, "type", ""), Ops.get(resourcerecord, "value", "") ] ) end end ScreenWizard( # TRANSLATORS: commandline section header _("Mail Servers:"), # TRANSLATORS: commandline table header item String.TextTable( [ # TRANSLATORS: commandline table header item _("Zone"), # TRANSLATORS: commandline table header item _("Record Query"), # TRANSLATORS: commandline table header item _("Record Type"), # TRANSLATORS: commandline table header item _("Record Value") ], table_items, {} ) ) true end |
- (Object) DNSHandlerSOA(options)
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 |
# File '../../src/include/dns-server/cmdline.rb', line 1166 def DNSHandlerSOA() = deep_copy() if Ops.get(, "show") != nil DNSHandlerSOAShow(Ops.get_string(, "zone")) return false elsif Ops.get(, "set") != nil params = {} Builtins.foreach( ["serial", "ttl", "refresh", "retry", "expiry", "minimum"] ) do |param| if Ops.get(, param) != nil && Ops.get(, param) != "" Ops.set( params, param, Builtins.tostring(Ops.get_string(, param, "")) ) end end DnsServerAPI.SetZoneSOA(Ops.get_string(, "zone", ""), params) end nil end |
- (Object) DNSHandlerSOAShow(only_for_zone)
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 |
# File '../../src/include/dns-server/cmdline.rb', line 1130 def DNSHandlerSOAShow(only_for_zone) table_items = [] if only_for_zone == nil || only_for_zone == "" Missing("zone") return false end zone_soa = DnsServerAPI.GetZoneSOA(only_for_zone) Builtins.foreach( ["serial", "ttl", "refresh", "retry", "expiry", "minimum"] ) do |param| table_items = Builtins.add( table_items, [param, Ops.get(zone_soa, param, "")] ) end ScreenWizard( # TRANSLATORS: commandline section header _("Start of Authority (SOA):"), # TRANSLATORS: commandline table header item String.TextTable( [ # TRANSLATORS: commandline table header item _("Key"), # TRANSLATORS: commandline table header item _("Value") ], table_items, {} ) ) true end |
- (Object) DNSHandlerStartup(options)
Function for handling commandline 'startup'
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 |
# File '../../src/include/dns-server/cmdline.rb', line 516 def DNSHandlerStartup() = deep_copy() # both cannot be together if Ops.get(, "atboot") != nil && Ops.get(, "manual") != nil # TRANSLATORS: commandline section header ScreenWizard(_("Start-Up Settings:"), "") # TRANSLATORS: commandline error message CommandLine.Error(_("Only one parameter is allowed.")) # start at boot elsif Ops.get(, "atboot") != nil ScreenWizard( # TRANSLATORS: commandline section header _("Start-Up Settings:"), # TRANSLATORS: commandline progress information _("Enabling DNS server in the boot process...") ) DnsServer.SetStartService(true) return true # start manually elsif Ops.get(, "manual") != nil ScreenWizard( # TRANSLATORS: commandline section header _("Start-Up Settings:"), # TRANSLATORS: commandline progress information _("Removing DNS server from the boot process...") ) DnsServer.SetStartService(false) return true # show current state elsif Ops.get(, "show") != nil content = "" if DnsServer.GetStartService # TRANSLATORS: commandline DNS service status information content = _("DNS server is enabled in the boot process.") else # TRANSLATORS: commandline DNS service status information content = _("DNS server needs manual starting.") end # TRANSLATORS: commandline section header ScreenWizard(_("Start-Up Settings:"), content) return false end false end |
- (Object) DNSHandlerTransport(options)
992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 |
# File '../../src/include/dns-server/cmdline.rb', line 992 def DNSHandlerTransport() = deep_copy() if Ops.get(, "show") != nil DNSHandlerTransportShow(Ops.get_string(, "zone")) return false elsif Ops.get(, "enable") != nil && Ops.get(, "disable") != nil CommandLine.Error(_("Only one action parameter is allowed.")) return false elsif Ops.get(, "enable") != nil return DnsServerAPI.AddZoneTransportACL( Ops.get_string(, "zone"), Ops.get_string(, "enable") ) elsif Ops.get(, "disable") != nil return DnsServerAPI.RemoveZoneTransportACL( Ops.get_string(, "zone"), Ops.get_string(, "disable") ) end false end |
- (Object) DNSHandlerTransportShow(only_for_zone)
963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 |
# File '../../src/include/dns-server/cmdline.rb', line 963 def DNSHandlerTransportShow(only_for_zone) table_items = [] Builtins.foreach(DnsServerAPI.GetZones) do |zone_name, zone| # skipping all zones which arent requested next if only_for_zone != nil && only_for_zone != zone_name Builtins.foreach(DnsServerAPI.GetZoneTransportACLs(zone_name)) do |acl| table_items = Builtins.add(table_items, [zone_name, acl]) end end ScreenWizard( # TRANSLATORS: commandline section header _("Zone Transport:"), # TRANSLATORS: commandline table header item String.TextTable( [ # TRANSLATORS: commandline table header item _("Zone"), # TRANSLATORS: commandline table header item _("Enabled ACL") ], table_items, {} ) ) true end |
- (Object) DNSHandlerZones(options)
Function for handling DNS zones in general
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 |
# File '../../src/include/dns-server/cmdline.rb', line 857 def DNSHandlerZones() = deep_copy() Builtins.y2milestone("Options: %1", ) # Show current settings if Ops.get(, "show") != nil return DNSHandlerZonesShow() # Both Add and Remove defined => Error! elsif Ops.get(, "add") != nil && Ops.get(, "remove") != nil CommandLine.Error(_("Only one action parameter is allowed.")) return false # Adding zone elsif Ops.get(, "add") != nil if DnsServerAPI.AddZone( Ops.get_string(, "name"), Ops.get_string(, "zonetype"), { "masterserver" => Ops.get_string(, "masterserver") } ) if Ops.get_string(, "zonetype") == "forward" return DnsServerAPI.SetZoneForwarders( Ops.get_string(, "name"), Builtins.splitstring( Ops.get_string(, "forwarders", ""), "," ) ) else return true end else Builtins.y2error("Cannot add new zone %1", ) return false end # Removing zone elsif Ops.get(, "remove") != nil return DnsServerAPI.RemoveZone(Ops.get_string(, "name")) # Changing settings elsif Ops.get(, "set") != nil # Zone MasterServers if Ops.get(, "masterserver") != nil return DnsServerAPI.SetZoneMasterServers( Ops.get_string(, "name"), [Ops.get_string(, "masterserver")] ) # Zone Forwarders elsif Ops.get(, "forwarders") != nil return DnsServerAPI.SetZoneForwarders( Ops.get_string(, "name"), Builtins.splitstring(Ops.get_string(, "forwarders", ""), ",") ) end end false end |
- (Object) DNSHandlerZonesShow
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 |
# File '../../src/include/dns-server/cmdline.rb', line 811 def DNSHandlerZonesShow table_items = [] Builtins.foreach(DnsServerAPI.GetZones) do |zone_name, zone| masterservers = [] forwarders = [] if Ops.get(zone, "type") == "slave" masterservers = DnsServerAPI.GetZoneMasterServers(zone_name) elsif Ops.get(zone, "type") == "forward" forwarders = DnsServerAPI.GetZoneForwarders(zone_name) end table_items = Builtins.add( table_items, [ zone_name, Ops.get(zone, "type"), Builtins.mergestring(masterservers, ", "), Builtins.mergestring(forwarders, ", ") ] ) end ScreenWizard( # TRANSLATORS: commandline section header, _("DNS Zones:"), # TRANSLATORS: commandline table header item String.TextTable( [ # TRANSLATORS: commandline table header item _("Name"), # TRANSLATORS: commandline table header item _("Type"), # TRANSLATORS: commandline table header item _("Master Server"), # TRANSLATORS: commandline table header item _("Forwarders") ], table_items, {} ) ) false end |
- (Object) GetLoggingAdditionals
Function returns map $[ queries : (yes|no), updates : (yes|no), transfers : (yes|no) ]
630 631 632 633 634 635 636 637 638 639 |
# File '../../src/include/dns-server/cmdline.rb', line 630 def GetLoggingAdditionals categories = DnsServerAPI.GetLoggingCategories addlog = { "queries" => "no", "xfer-in" => "no", "xfer-out" => "no" } Builtins.foreach(categories) do |category| Ops.set(addlog, category, "yes") end deep_copy(addlog) end |
- (Object) initialize_dns_server_cmdline(include_target)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File '../../src/include/dns-server/cmdline.rb', line 13 def initialize_dns_server_cmdline(include_target) textdomain "dns-server" Yast.import "CommandLine" Yast.import "String" Yast.import "DnsServer" Yast.import "DnsServerAPI" @cmdline = { "id" => "dns-server", # TRANSLATORS: commandline general name of the module in help "help" => _( "DNS server configuration" ), "initialize" => fun_ref(DnsServer.method(:Read), "boolean ()"), "finish" => fun_ref(DnsServer.method(:Write), "boolean ()"), "actions" => { "startup" => { "handler" => fun_ref(method(:DNSHandlerStartup), "boolean (map)"), "help" => _("Start-up settings"), "example" => ["startup show", "startup atboot; startup manual"] }, "forwarders" => { "handler" => fun_ref(method(:DNSHandlerForwarders), "boolean (map)"), # TRANSLATORS: commandline short help for command "help" => _( "DNS forwarders" ), "example" => [ "forwarders show", "forwarders add ip=125.11.235.1", "forwarders remove ip=44.82.1.12" ] }, "logging" => { "handler" => fun_ref(method(:DNSHandlerLogging), "boolean (map)"), # TRANSLATORS: commandline short help for command "help" => _( "Logging settings" ), "example" => [ "logging show", "logging set updates=no transfers=yes", "logging destination=syslog", "logging destination=file maxsize=0 file=/var/log/named.log maxversions=0" ] }, "zones" => { "handler" => fun_ref(method(:DNSHandlerZones), "boolean (map)"), # TRANSLATORS: commandline short help for command "help" => _( "DNS zones" ), "example" => [ "zones show", "zones add name=example.org zonetype=master", "zones add name=example.com zonetype=slave masterserver=192.168.0.1", "zones add name=example.com zonetype=forward forwarders=192.168.0.1,192.168.0.2", "zones remove name=example.org", "zones set name=example.com masterserver=192.168.10.1", "zones set name=example.com forwarders=192.168.0.3" ] }, "acls" => { "handler" => fun_ref(method(:DNSHandlerACLs), "boolean (map)"), # TRANSLATORS: commandline short help for command "help" => _( "Access control lists" ), "examples" => ["acls show"] }, "transport" => { "handler" => fun_ref(method(:DNSHandlerTransport), "boolean (map)"), # TRANSLATORS: commandline short help for command "help" => _( "Zone transport rules" ), "examples" => [ "transport show", "transport show zone=example.com", "transport zone=master.com enable=localnets" ] }, "nameserver" => { "handler" => fun_ref( method(:DNSHandlerNameServers), "boolean (map)" ), # TRANSLATORS: commandline short help for command, base cmdline command "help" => _( "Zone name servers" ), "example" => [ "nameserver show", "nameserver show zone=example.com", "nameserver add zone=example.com ns=ns1", "nameserver add zone=example.com ns=ns2.example.com.", "nameserver remove zone=example.com ns=ns2" ] }, "mailserver" => { "handler" => fun_ref( method(:DNSHandlerMailServers), "boolean (map)" ), # TRANSLATORS: commandline short help for command, base cmdline command "help" => _( "Zone mail servers" ), "example" => [ "mailserver show", "mailserver show zone=example.org", "mailserver add zone=example.org mx=mx1 priority=100", "mailserver add zone=example.org mx=mx2.example.com. priority=99", "mailserver remove zone=example.org mx=mx2.example.com. priority=99" ] }, "soa" => { "handler" => fun_ref(method(:DNSHandlerSOA), "boolean (map)"), # TRANSLATORS: commandline short help for command, base cmdline command "help" => _( "Start of authority (SOA)" ), "example" => [ "soa show zone=example.org", "soa set zone=example.org serial=2006081623 ttl=2D3H20S", "soa set zone=example.org serial=2006081624 expiry=1W retry=180" ] }, "dnsrecord" => { "handler" => fun_ref( method(:DNSHandlerResourceRecords), "boolean (map)" ), # TRANSLATORS: commandline short help for command, base cmdline command "help" => _( "Zone resource records, such as A, CNAME, NS, MX, or PTR" ), "example" => [ "dnsrecord show", "dnsrecord show zone=example.org", "dnsrecord show zone=example.org type=A", "dnsrecord add zone=example.org query=office.example.org. type=NS value=ns3", "dnsrecord add zone=example.org query=ns3 type=CNAME value=server3.anywhere.net.", "dnsrecord remove zone=example.org query=office type=A value=192.168.32.1" ] }, "host" => { "handler" => fun_ref( method(:DNSHandlerHostRecords), "boolean (map)" ), # TRANSLATORS: commandline short help for command, base cmdline command, A is record type "help" => _( "Handles A and corresponding PTR record at once" ), "example" => [ "host show", "host show zone=example.org", "host add zone=master.com hostname=examplehost.example.org. ip=192.168.0.201", "host remove zone=master.com hostname=examplehost ip=192.168.0.201" ] } }, "options" => { "show" => { # TRANSLATORS: commandline short help for command "help" => _( "Show current settings" ) }, "atboot" => { # TRANSLATORS: commandline short help for command "help" => _( "Start DNS server in the boot process" ) }, "manual" => { # TRANSLATORS: commandline short help for command "help" => _( "Start DNS server manually" ) }, "add" => { # TRANSLATORS: commandline short help for command "help" => _( "Add a new record" ) }, "remove" => { # TRANSLATORS: commandline short help for command "help" => _( "Remove a record" ) }, "ip" => { "type" => "ip4", # TRANSLATORS: commandline short help for command "help" => _( "IPv4 address" ) }, "destination" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Logging destination (syslog|file)" ) }, "set" => { # TRANSLATORS: commandline short help for command "help" => _( "Set option" ) }, "file" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Filename for logging (full path)" ) }, "maxsize" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Maximum log size [0-9]+(KMG)*" ) }, "maxversions" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Maximum number of versions for rotation, '0' means no rotation" ) }, "name" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Zone name" ) }, "zonetype" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Zone type, master or slave" ) }, "masterserver" => { "type" => "ip4", # TRANSLATORS: commandline short help for command "help" => _( "DNS zone master server" ) }, "zone" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Zone name" ) }, "enable" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Enable option" ) }, "disable" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Disable option" ) }, "ns" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Name server (in fully qualified format finished with a dot or relative name)" ) }, "mx" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Mail server (in fully qualified format finished with a dot or relative name)" ) }, "priority" => { "type" => "integer", # TRANSLATORS: commandline short help for command "help" => _( "Mail server priority (number from 0 to 65535)" ) }, "serial" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Serial number of zone update" ) }, "ttl" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "General time to live of records in zone" ) }, "refresh" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "An interval before the zone records should be refreshed" ) }, "retry" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Interval between retries of failed refresh" ) }, "expiry" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Interval after which zone records are no longer authoritative" ) }, "minimum" => { "type" => "string", # TRANSLATORS: commandline short help for command, TTL is DNS-Specific (Time to Live), shouldn't be translated "help" => _( "Minimum TTL that should be exported with records in this zone" ) }, "type" => { "type" => "string", # TRANSLATORS: commandline short help for command, Types are DNS-Specific, cannot be translated "help" => _( "DNS resource record type, such as A, CNAME, NS, MX, or PTR" ) }, "query" => { "type" => "string", # TRANSLATORS: commandline short help for command, DNS query is a question for value when we have a /key/ and type, ('A' record for 'example.org'? -> 192.0.34.166) "help" => _( "DNS query, such as example.org for A record" ) }, "value" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "DNS resource record value, such as 192.0.34.166 for example.org's A record" ) }, "hostname" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Hostname for the DNS record" ) }, "queries" => { "type" => "string", # TRANSLATORS: commandline short help for command, %1 are possible untranlatable parameters "(yes|no)" "help" => Builtins.sformat( _("Log named queries %1"), "(yes|no)" ) }, "updates" => { "type" => "string", # TRANSLATORS: commandline short help for command, %1 are possible untranlatable parameters "(yes|no)" "help" => Builtins.sformat( _("Log zone updates %1"), "(yes|no)" ) }, "transfers" => { "type" => "string", # TRANSLATORS: commandline short help for command, %1 are possible untranlatable parameters "(yes|no)" "help" => Builtins.sformat( _("Log zone transfers %1"), "(yes|no)" ) }, "forwarders" => { "type" => "string", # TRANSLATORS: commandline short help for command "help" => _( "Comma-separated list of zone forwarders" ) } }, "mappings" => { "startup" => ["show", "atboot", "manual"], "forwarders" => ["show", "add", "remove", "ip"], "logging" => [ "show", "destination", "set", "file", "maxsize", "maxversions", "queries", "transfers", "updates" ], "zones" => [ "show", "add", "remove", "set", "name", "masterserver", "zonetype", "forwarders" ], "acls" => ["show"], "transport" => ["show", "enable", "disable", "zone"], "nameserver" => ["show", "add", "remove", "ns", "zone"], "mailserver" => ["show", "add", "remove", "mx", "zone", "priority"], "soa" => [ "show", "set", "zone", "serial", "ttl", "refresh", "retry", "expiry", "minimum" ], "dnsrecord" => [ "show", "add", "remove", "zone", "query", "type", "value" ], "host" => ["show", "add", "remove", "zone", "hostname", "ip"] } } Builtins.y2milestone("----------------------------------------") Builtins.y2milestone( Builtins.sformat("Starting CommandLine with parameters %1", WFM.Args) ) CommandLine.Run(@cmdline) Builtins.y2milestone("----------------------------------------") # EOF end |
- (Object) Missing(missing_parameter)
Function prints commandline error about missing parameter
490 491 492 493 494 495 496 497 498 499 500 |
# File '../../src/include/dns-server/cmdline.rb', line 490 def Missing(missing_parameter) CommandLine.Error( Builtins.sformat( # TRANSLATORS: command line error message, %1 is a missing required parameter _("Parameter %1 is required."), missing_parameter ) ) nil end |
- (Object) ScreenWizard(header, content)
Wizard Screen function formats and prints unifyied commandline screen
477 478 479 480 481 482 483 484 485 486 487 |
# File '../../src/include/dns-server/cmdline.rb', line 477 def ScreenWizard(header, content) CommandLine.Print("") CommandLine.Print(String.UnderlinedHeader(header, 0)) CommandLine.Print("") if content != "" CommandLine.Print(content) CommandLine.Print("") end nil end |
- (Object) SetLogTo(settings)
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 |
# File '../../src/include/dns-server/cmdline.rb', line 600 def SetLogTo(settings) settings = deep_copy(settings) # $[ # "type" : "file", # "file" : options["file"]:"", # "maxsize" : options["maxsize"]:"0", # "maxversions" : options["maxversions"]:"0" # ] if Ops.get(settings, "type") == "syslog" DnsServerAPI.SetLoggingChannel({ "destination" => "syslog" }) elsif Ops.get(settings, "type") == "file" DnsServerAPI.SetLoggingChannel( { "destination" => "file", "filename" => Ops.get(settings, "file", ""), "size" => Ops.get(settings, "maxsize", ""), "versions" => Ops.get(settings, "maxversions", "") } ) else # unknown logging Builtins.y2error("Unknown logging type '%1'", Ops.get(settings, "type")) return end nil end |
- (Object) UnknownValue(cmdline_parameter)
Function prints commandline error about unknown value for option
503 504 505 506 507 508 509 510 511 512 513 |
# File '../../src/include/dns-server/cmdline.rb', line 503 def UnknownValue(cmdline_parameter) CommandLine.Error( Builtins.sformat( # TRANSLATORS: command line error message, %1 is a parameter name _("Unknown value for parameter %1."), cmdline_parameter ) ) nil end |