@@ -44,16 +44,20 @@ def main():
44
44
return
45
45
46
46
if args .type == 'site' :
47
- update_site (args , enable_materialized_views , password , site_content_url )
47
+ if not update_site (args , enable_materialized_views , password , site_content_url ):
48
+ return
48
49
49
50
elif args .type == 'workbook' :
50
- update_workbook (args , enable_materialized_views , password , site_content_url )
51
+ if not update_workbook (args , enable_materialized_views , password , site_content_url ):
52
+ return
51
53
52
54
elif args .type == 'project_name' :
53
- update_project_by_name (args , enable_materialized_views , password , site_content_url )
55
+ if not update_project_by_name (args , enable_materialized_views , password , site_content_url ):
56
+ return
54
57
55
58
elif args .type == 'project_path' :
56
- update_project_by_path (args , enable_materialized_views , password , site_content_url )
59
+ if not update_project_by_path (args , enable_materialized_views , password , site_content_url ):
60
+ return
57
61
58
62
if args .status :
59
63
show_materialized_views_status (args , password , site_content_url )
@@ -110,7 +114,7 @@ def show_materialized_views_status(args, password, site_content_url):
110
114
def update_project_by_path (args , enable_materialized_views , password , site_content_url ):
111
115
if args .project_path is None :
112
116
print ("Use --project_path <project path> to specify the path of the project" )
113
- return
117
+ return False
114
118
tableau_auth = TSC .TableauAuth (args.username , password , site_content_url )
115
119
server = TSC .Server (args .server , use_server_version = True )
116
120
project_name = args .project_path .split ('/' )[- 1 ]
@@ -119,12 +123,13 @@ def update_project_by_path(args, enable_materialized_views, password, site_conte
119
123
120
124
possible_paths = get_project_paths (server , projects )
121
125
update_project (possible_paths [args .project_path ], server , enable_materialized_views )
126
+ return True
122
127
123
128
124
129
def update_project_by_name (args , enable_materialized_views , password , site_content_url ):
125
130
if args .project_name is None :
126
131
print ("Use --project-name <project name> to specify the name of the project" )
127
- return
132
+ return False
128
133
tableau_auth = TSC .TableauAuth (args .username , password , site_content_url )
129
134
server = TSC .Server (args .server , use_server_version = True )
130
135
with server .auth .sign_in (tableau_auth ):
@@ -137,9 +142,10 @@ def update_project_by_name(args, enable_materialized_views, password, site_conte
137
142
print ("Possible project paths:" )
138
143
print_paths (possible_paths )
139
144
print ('\n ' )
140
- return
145
+ return False
141
146
else :
142
147
update_project (projects [0 ], server , enable_materialized_views )
148
+ return True
143
149
144
150
145
151
def update_project (project , server , enable_materialized_views ):
@@ -165,14 +171,14 @@ def update_workbook(args, enable_materialized_views, password, site_content_url)
165
171
if args .file_path is None :
166
172
print ("Use '--file-path <file path>' to specify the path of a list of workbooks" )
167
173
print ('\n ' )
168
- return
169
-
174
+ return False
170
175
tableau_auth = TSC .TableauAuth (args .username , password , site_id = site_content_url )
171
176
server = TSC .Server (args .server , use_server_version = True )
172
177
with server .auth .sign_in (tableau_auth ):
173
178
workbook_path_mapping = parse_workbook_path (args .file_path )
174
179
all_projects = {project .id : project for project in TSC .Pager (server .projects )}
175
180
update_workbooks_by_paths (all_projects , enable_materialized_views , server , workbook_path_mapping )
181
+ return True
176
182
177
183
178
184
def update_workbooks_by_paths (all_projects , enable_materialized_views , server , workbook_path_mapping ):
@@ -201,6 +207,7 @@ def update_site(args, enable_materialized_views, password, site_content_url):
201
207
server .sites .update (site_to_update )
202
208
print ("Updated materialized views settings for site: {}" .format (site_to_update .name ))
203
209
print ('\n ' )
210
+ return True
204
211
205
212
206
213
if __name__ == "__main__" :
0 commit comments